【发布时间】:2020-08-25 08:19:19
【问题描述】:
假设一个变量
varCode = kvnownananna.ThisistheStringRequired.iobabvoabnv
我需要删除.(点)之前的前缀并删除第二个.(点)之后的后缀
只需要获取“ThisistheStringRequired”。
我们如何在 xsl-fo 模板中做到这一点?
【问题讨论】:
标签: xslt xslt-1.0 xslt-2.0 xsl-fo
假设一个变量
varCode = kvnownananna.ThisistheStringRequired.iobabvoabnv
我需要删除.(点)之前的前缀并删除第二个.(点)之后的后缀
只需要获取“ThisistheStringRequired”。
我们如何在 xsl-fo 模板中做到这一点?
【问题讨论】:
标签: xslt xslt-1.0 xslt-2.0 xsl-fo
<xsl:variable name="newVar" select="replace($varCode, '.*\.(.*)\..*', '$1')"/>
或
<xsl:variable name="newVar" select="tokenize($varCode, '.')[2]"/>
【讨论】:
试试:
<xsl:value-of select="substring-before(substring-after($varCode, '.'), '.')"/>
【讨论】:
<xsl:variable name="anotherVar" select="substring-before(substring-after($varCode, '.'), '.')"/>。 XSLT 中的变量是不可变的。