【问题标题】:distinct-values() function won't work in XSLdistinct-values() 函数在 XSL 中不起作用
【发布时间】:2013-09-15 17:02:56
【问题描述】:

我正在尝试使用 XSLT 创建一个新的 XML 文档来转换现有的文档。 我的问题是 distinct-values() 函数不会像我期望的那样工作。 我的 XML 如下:

<parlamento>
 <parlamentare cognome="Adornato" 
 partito="UDC"/>
 <parlamentare cognome="Barbato" 
 partito="IdV"/>
 <parlamentare cognome="Bondi" 
 partito="PDL"/>
 <parlamentare cognome="Casini" 
 partito="UDC"/>
 <parlamentare cognome="Bossi" 
 partito="Lega Nord"/>
 <parlamentare cognome="Cesa" 
 partito="UDC"/>
 <parlamentare cognome="Chiamparino" 
 partito="PD"/>
 <parlamentare cognome="Cicchitto" 
 partito="PDL"/>
 <parlamentare cognome="Cota" 
 partito="Lega Nord"/>
 <parlamentare cognome="Di Giuseppe" 
 partito="IdV"/>
 <parlamentare cognome="Di Pietro" 
 partito="IdV"/>
 <parlamentare cognome="Fassino" 
 partito="PD"/>
 <parlamentare cognome="Finocchiaro" 
 partito="PD"/>
 <parlamentare cognome="Lupi" 
 partito="PDL"/>
 <parlamentare cognome="Maroni" 
 partito="Lega Nord"/>
</parlamento>

我正在尝试做这样的事情:

distinct-values(//parlamentare/@partito)

有人知道为什么我的评估员无法识别这条线吗? 非常感谢您!

【问题讨论】:

    标签: xml xslt xpath distinct-values


    【解决方案1】:

    distinct-values 是 2007 年在 XPath 2.0 版中引入的,这种方式仅受 XSLT 2.0 处理器(如 Saxon 9、AltovaXML 或 XmlPrime)支持。 XSLT 1.0 处理器(如 Xalan 或 libxslt/xsltproc)或主要浏览器中的各种 XSLT 实现不支持该功能。因此,您需要更改为 XSLT 2.0 处理器,或者您需要对 XSLT 1.0 处理器使用不同的方法,例如 Muenchian grouping

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-05
      • 1970-01-01
      • 2012-10-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多