我正在使用<xsl:number>
来计数<proceduralStep>
。 (我使用的天线众议院6.2)从xsl中排除具有某些属性值的元素:数字
<xsl:number count="proceduralStep" from="content" level="multiple" format="1.1.1.1.1"/>
但我想排除有家长或孩子与属性的任何proceduralStep @changeType='delete'
的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
另一个问题是WH连接使用<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"/>
引发错误:只有 '孩子' 和 '属性' 轴允许在谓词外的匹配模式
非常感谢!这很好。我并没有理解为什么'a!= b'不等于'not(a = b)'(我仍然遇到了这样的问题:在这个级别重新开始编号。) – Caroline
** 1。**因为'a!= b'将不**返回真,当'a'不存在时。 ** 2。**我怀疑你想使用'level =“any”'。很难确定使用你的例子。 –
嵌套步骤需要'level = multiple',所以我会努力。太糟糕了,因为'level =“任何”'编号正确。迈克尔,你真的很有帮助,我很感激! – Caroline