How do you do case conversion in XSL?
<xsl:variable name="upper">UPPER CASE</xsl:variable>
<xsl:variable name="lower" select="???"/>
From stackoverflow
-
upper-case(string) and lower-case(string)
-
XSLT 2.0 has
upper-case()andlower-case()functions. In case of XSLT 1.0, you can usetranslate():translate("xslt", "abcdefghij...z", "ABCDEFGHIJ...Z") -
In XSLT 1.0 the
upper-case()andlower-case()functions are not available. If you're using a 1.0 stylesheet the common method of case conversion istranslate():<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>Jweede : 2 minutes too late. This is what I get for going into detail. :)mjs : Is there a Unicode version? This solution is not going to work with funny characters...Jweede : For XSLT 1.0 you'd have to add more to the smallcase/uppercase variables or use an extension function.Jweede : If you decided not to use the extention function you might be able to make a complete list using the Unicode Character Database: http://www.unicode.org/Public/UNIDATA/UCD.html
0 comments:
Post a Comment