Xslt 根据上下文选择子字符串
我有这段XML,希望在Xslt 根据上下文选择子字符串,xslt,Xslt,我有这段XML,希望在章节之后立即获得编号 <para>Insolvency Rules, r 12.12, which gives the court a broad discretion, unfettered by the English equivalent of the heads of Order 11, r 1(1) (which are now to be found, in England, in CPR, Chapter 6, disapplied in the
章节之后立即获得编号
<para>Insolvency Rules, r 12.12, which gives the court a broad discretion, unfettered by the English equivalent of the heads of Order 11, r 1(1) (which are now to be found, in England, in CPR, Chapter 6, disapplied in the insolvency context by Insolvency Rules, r 12.12(1)). </para>
但是我只想要6
请告诉我该怎么做
我不想用这种说法
<xsl:value-of select="substring-before(substring-after(current(),'Chapter'), ,',')"/>
因为每种情况下的章节号都会有所不同,介于1和15之间。尝试以下方法:
<xsl:variable name="vS" select="concat(substring-after(current(),'Chapter '),'Z')"/>
<xsl:value-of select=
"substring-before(translate($vS,translate($vS,'0123456789',''),'Z'),'Z')"/>
这是基于:感谢
@迪米特里·诺瓦切夫
更新:如果“章节”后的空间数量未知,您可以使用以下内容:
<xsl:variable name="vS" select="concat(substring-after(current(),'Chapter'),'Z')"/>
<xsl:value-of select=
" translate(
substring-before(translate($vS,translate($vS,' 0123456789',''),'Z'),'Z')
, ' ','')"/>
<xsl:variable name="vS" select="concat(substring-after(current(),'Chapter '),'Z')"/>
<xsl:value-of select=
"substring-before(translate($vS,translate($vS,'0123456789',''),'Z'),'Z')"/>
<xsl:variable name="vS" select="concat(substring-after(current(),'Chapter'),'Z')"/>
<xsl:value-of select=
" translate(
substring-before(translate($vS,translate($vS,' 0123456789',''),'Z'),'Z')
, ' ','')"/>