我知道現在已經有一個關於在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: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>
我需要一份聲明取代 「./z30-collection」
If ./z30-collection = "Deposit" replace with "DEP"
if ./z30-collection = "General" replace with "GEN"
if ./z30-collection = "Storage" replace with "STORE"
等等
任何幫助將不勝感激!
你可能意味着只是字符串輸出(而不是替換)。或者你想要替換哪一個字符串?從您的描述中不清楚。順便說一句, – DRCB
。檢查''元素。 http://www.w3schools.com/xsl/xsl_choose.asp –
DRCB