XSLT 错误“不是节点项”
我正在尝试从平面结构创建嵌套层次结构,并且使用以下键:
<xsl:key name="next-headings"
match="w:p[w:pPr/w:pStyle/@w:val = 'Heading3']"
use="generate-id((ancestor::w:sdt[1] |
preceding-sibling::w:p
[w:pPr/w:pStyle/@w:val = 'Heading1'] or
preceding-sibling::w:p
[w:pPr/w:pStyle/@w:val = 'Heading2']
)[last()])"/>
我收到“不是节点项”错误,但不明白为什么。非常感谢任何翻译此错误的帮助!
I'm trying to create a nested hierarchy from a flat structure, and I am using the following key:
<xsl:key name="next-headings"
match="w:p[w:pPr/w:pStyle/@w:val = 'Heading3']"
use="generate-id((ancestor::w:sdt[1] |
preceding-sibling::w:p
[w:pPr/w:pStyle/@w:val = 'Heading1'] or
preceding-sibling::w:p
[w:pPr/w:pStyle/@w:val = 'Heading2']
)[last()])"/>
I am getting the "not a node item" error, but don't understand why. Any help in translating this error is much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 @LarsH 所回答的,
or
运算符比|
联合运算符具有更高的优先级,并且它会产生一个无法联合到节点集的布尔表达式。但是,除此之外,您似乎想将
or
运算符替换为|
联合,我会使用以下表达式:编辑:小拼写错误...
As @LarsH has answered, the
or
operator has more precedence that|
union operator, and it results in a boolean expression that you can't union to a node set.But, besides that it looks like you want to replace the
or
operator for a|
union, I would use this expression:Edit: little typo...
我认为您需要将
or
更改为|
。您的意思是通过联合 (|
) 创建节点集,但or
运算符返回一个布尔值,它“不是节点项”。I think you need to change
or
to|
. You meant create a nodeset via union (|
), but theor
operator returns a boolean value, which is "not a node item".