Xml XSLT字符串替换,多变量
我知道在XSLT中替换字符串已经有问题了,但是我需要一个条件语句来用多个变量替换一个字符串 这是我的密码:Xml XSLT字符串替换,多变量,xml,xslt,Xml,Xslt,我知道在XSLT中替换字符串已经有问题了,但是我需要一个条件语句来用多个变量替换一个字符串 这是我的密码: <xsl:template name="section-01"> <xsl:call-template name="table-open"/> <xsl:text disable-output-escaping="yes"><table style="text-align=center;"></xsl:text&
<xsl:template name="section-01">
<xsl:call-template name="table-open"/>
<xsl:text disable-output-escaping="yes"><table style="text-align=center;"></xsl:text>
<xsl:call-template name="display-gen">
<xsl:with-param name="value" select="./z30-collection"/>
<xsl:with-param name="width" select="'30%'"/>
</xsl:call-template>
<xsl:call-template name="display-gen">
<xsl:with-param name="value" select="./call-no-piece-01"/>
<xsl:with-param name="width" select="'30%'"/>
</xsl:call-template>
<xsl:call-template name="table-close"/>
</xsl:template>
等等
任何帮助都将不胜感激 这里是XSLT函数,其工作方式与String.Replace()类似 此模板具有以下3个参数 text:-您的主字符串 replace:-要替换的字符串 by:-将通过新字符串进行回复的字符串
这里是XSLT函数,它的工作原理与String.Replace()类似 此模板具有以下3个参数 text:-您的主字符串 replace:-要替换的字符串 by:-将通过新字符串进行回复的字符串 参考处理类似问题的最“XSLT”方法是为不同的情况定义不同的模板
<xsl:template match="z30-collection[. = 'Deposit']">
<xsl:text>DEP</xsl:text>
</xsl:template>
<xsl:template match="z30-collection[. = 'General']">
<xsl:text>GEN</xsl:text>
</xsl:template>
<xsl:template match="z30-collection[. = 'Storage']">
<xsl:text>STORE</xsl:text>
</xsl:template>
<!-- catch-all for elements that don't have any of the three specific values -->
<xsl:template match="z30-collection">
<xsl:value-of select="." />
</xsl:template>
副署长
消息
贮藏
然后当你需要你所做的价值时
<xsl:apply-templates select="z30-collection"/>
模板匹配器将自动选择适用于此特定情况的最具体的模板。不需要任何显式的条件检查,matcher会为您处理这些问题。处理类似问题的最“XSLT”方法是为不同的情况定义不同的模板
<xsl:template match="z30-collection[. = 'Deposit']">
<xsl:text>DEP</xsl:text>
</xsl:template>
<xsl:template match="z30-collection[. = 'General']">
<xsl:text>GEN</xsl:text>
</xsl:template>
<xsl:template match="z30-collection[. = 'Storage']">
<xsl:text>STORE</xsl:text>
</xsl:template>
<!-- catch-all for elements that don't have any of the three specific values -->
<xsl:template match="z30-collection">
<xsl:value-of select="." />
</xsl:template>
副署长
消息
贮藏
然后当你需要你所做的价值时
<xsl:apply-templates select="z30-collection"/>
模板匹配器将自动选择适用于此特定情况的最具体的模板。不需要任何显式条件检查,matcher会为您处理这些问题。您可能指的是字符串输出(而不是替换)。或者要替换哪个字符串?从你的描述中不清楚。顺便说一下。检查
元素。您可能只是指字符串输出(而不是替换)。或者要替换哪个字符串?从你的描述中不清楚。顺便说一下。检查
元素。