有人能告诉我我做错了什么吗?当<xsl:value-of select="string-length(add:Destinations/add:DestinationName)" />
=加利福尼亚州萨克拉门托我期望可变区域是西部,但我得到东部。XSLT选择不工作
<xsl:variable name="charCount">
<xsl:value-of select="string-length(add:Destinations/add:DestinationName)" />
</xsl:variable>
<xsl:variable name="amendedCharCount">
<xsl:value-of select="$charCount - 2"/>
</xsl:variable>
<xsl:variable name="state">
<xsl:value-of select="substring(add:Destinations/add:DestinationName,$amendedCharCount)"/>
</xsl:variable>
<xsl:variable name="region">
<xsl:choose>
<xsl:when test="$state='CA'">west</xsl:when>
<xsl:otherwise>east</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="OperationsRegion">
<xsl:value-of select="$region"/>
</xsl:element>
你真的应该在问题中发布你的输入XML。谢谢。 –