How do you do case conversion in XSL?
<xsl:variable name="upper">UPPER CASE</xsl:variable>
<xsl:variable name="lower" select="???"/>
How do you do case conversion in XSL?
<xsl:variable name="upper">UPPER CASE</xsl:variable>
<xsl:variable name="lower" select="???"/>
XSLT 2.0 has upper-case()
and lower-case()
functions. In case of XSLT 1.0, you can use translate()
:
translate("xslt", "abcdefghij...z", "ABCDEFGHIJ...Z")
In XSLT 1.0 the upper-case()
and lower-case()
functions are not available.
If you're using a 1.0 stylesheet the common method of case conversion is translate()
:
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:template match="/">
<xsl:value-of select="translate(doc, $smallcase, $uppercase)" />
</xsl:template>