XSLT Stylesheet: Changing text to upper case
XSLT 2.0 has fn:upper-case() and fn:lower-case() functions. However in case you are using of XSLT 1.0, you can use translate():
<xsl:template match="/">
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:value-of select="translate(doc, $smallcase, $uppercase)" />
</xsl:template>
You can use the translate()
function in XSLT 1.0:
<xsl:value-of select="translate(//some-xpath,
'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
If you're lucky enough to have access to XSLT 2.0, you can use the upper-case()
function:
<xsl:value-of select="upper-case(//some-xpath)"/>
See the XPath function reference page for more details.