Xslt xsl-if中的xsl-if

Xslt xsl-if中的xsl-if,xslt,Xslt,嗨,我有下面的xml <primaryie> <content-style font-style="bold">Administration</content-style> </primaryie> 管理 当我应用下面的xslt时,它工作得很好。(内容样式部分) , –; 但我在同一文档中有一个特殊情况,如下所示 <primaryie> <content-style font-style="bold"&g

嗨,我有下面的xml

<primaryie>
<content-style font-style="bold">Administration</content-style>
</primaryie>

管理
当我应用下面的xslt时,它工作得很好。(内容样式部分)


, 
–;
但我在同一文档中有一个特殊情况,如下所示

<primaryie>
 <content-style font-style="bold">VIRRGIN system</content-style> 7.204, 7.205
</primaryie>

VIRRGIN系统7.204、7.205
在这里,当我应用上面的模板时,它与内容样式一起工作,但我希望它也与numberstolink模板一起工作

输出如下

当前:

 <div class="primaryie"><span class="font-style-bold">Virgin Islands Special Trust Act (VISTA) 9.077</span></div>
维尔京群岛特别信托法(VISTA)9.077
扩展:

 <div class="primaryie"><span class="font-style-bold">Virgin Islands Special Trust Act (VISTA)<a href="er:#BVI_CH_09/P9-077"> 9.077</a></span></div>
维尔京群岛特别信托法(VISTA)
请在代码中更改以下部分

<xsl:template match="primaryie">
    <div class="primaryie">
        <xsl:apply-templates select="content-style"/>
        <xsl:if test="contains(current(), '.')">
            <xsl:variable name="numberString" select="substring(current(), string-length(substring-before(current(),'.'))-1)"></xsl:variable>
            <xsl:call-template name="numbersToLink">
                <xsl:with-param name="numbersString" select="$numberString"></xsl:with-param>
            </xsl:call-template>
        </xsl:if>
    </div>
</xsl:template>

仅使用Current()而不是Current()/Text()

give XML的输出为

<div class="primaryie">VIRRGIN system<a href="er:#BVI_CH_07/P7-204"> 7.204</a>, <a href="er:#BVI_CH_07/P7-205">7.205</a></div>
VIRRGIN系统,

请在代码中更改以下部分

<xsl:template match="primaryie">
    <div class="primaryie">
        <xsl:apply-templates select="content-style"/>
        <xsl:if test="contains(current(), '.')">
            <xsl:variable name="numberString" select="substring(current(), string-length(substring-before(current(),'.'))-1)"></xsl:variable>
            <xsl:call-template name="numbersToLink">
                <xsl:with-param name="numbersString" select="$numberString"></xsl:with-param>
            </xsl:call-template>
        </xsl:if>
    </div>
</xsl:template>

仅使用Current()而不是Current()/Text()

give XML的输出为

<div class="primaryie">VIRRGIN system<a href="er:#BVI_CH_07/P7-204"> 7.204</a>, <a href="er:#BVI_CH_07/P7-205">7.205</a></div>
VIRRGIN系统,

请提供完整示例,或添加SplitbyHypen和splitByComma模板。您好,我已使用连字符和逗号模板更新了xslt。您发布的预期结果代码似乎有误,您正在关闭“”标记,但没有在itHey@Vloxxity中显示文本:很抱歉,我现在已经修复了。您好@Treemonkey我已经更新了xslt代码请提供完整的示例,或者添加SplitByHypen和splitByComma模板。您好,我已经使用Hypen和comma模板更新了xslt您发布的预期结果代码似乎是错误的,您正在关闭“”标记,但没有使用itHey@Vloxxity中的文本:很抱歉,我现在已经修复了。嗨@Treemonkey,我已经更新了xslt代码