版本更改错误

时间:2014-01-09 12:38:50

标签: xslt-1.0 xslt-2.0

当我使用XSLT语句进行转换时,如下所示。

<xsl:when test="preceding-sibling::title/@num and contains(./item/@num,'•')">

当我使用XSLT1.0版本时没有问题,但是当我将版本更改为2.0时,它会抛出以下错误,请告诉我如何解决这个问题。

XSLT 2.0 Debugging Error: Error: file:///C:/Users/u0138039/Desktop/Proview/MAL/Malaysian%20Civil%20Procedure%202013/XSLT/new_bull%20-%20Cols.xsl:704: Wrong occurrence to match required sequence type -   Details: -     XPTY0004: The supplied sequence ('4' item(s)) has the wrong occurrence to match the sequence type xs:string ('zero or one')

1 个答案:

答案 0 :(得分:1)

尝试contains((./item/@num)[1],'•')以确保只有一个节点作为contains的第一个参数。

请参阅http://www.w3.org/TR/xpath-functions/#func-contains,规范指出fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean第一个参数需要是空序列或单个项目,错误消息The supplied sequence ('4' item(s))表明您的代码{{1}选择四个项目。