【发布时间】:2017-04-26 18:11:39
【问题描述】:
我使用<xsl:number> 来计算<proceduralStep>。 (我用的是天线屋 6.2)
<xsl:number count="proceduralStep" from="content" level="multiple" format="1.1.1.1.1"/>
但我想排除任何具有属性@changeType='delete'的父或子的proceduralStep
XML 可能如下所示:
<proceduralStep><para>Install This.</para></proceduralStep>
<proceduralStep><para changeMark="1" changeType="delete">Delete this line.</para></proceduralStep>
<proceduralStep><para>Continue with ths</para></proceduralStep>
<proceduralStep><para><changeInline changeMark="1" changeType="delete">And this line.</changeInline></para></proceduralStep>
<proceduralStep><para>Continue with this</para></proceduralStep>
<revst changeMark="1" >
<proceduralStep><para>Turn the screw....</para></proceduralStep>
<proceduralStep><para>Hold assembly tool....</para></proceduralStep>
</revst>
输出应该是这样的
1.2.11 Install This
Delete this line
1.2.12 Continue with ths
另一个问题是当使用<revst> 作为<proceduralStep> 的包装器时,编号会重新开始:
1.2.13 Continue with this
1.2.1 Turn the screw....
1.2.2 Hold assembly tool...
代替:
1.2.13 Continue with this
1.2.14 Turn the screw....
1.2.15 Hold assembly tool...
<xsl:number count="ancestor-or-self::*[changeType!='delete']" from="content" level="multiple" format="1.1.1.1.1"/>
抛出错误:在谓词之外的匹配模式中只允许使用 'child' 和 'attribute' 轴
【问题讨论】: