Ron Peterson <ro*@shell.core .com> writes:
Jurrie <ju************ @hotmail.com> wrote: Is there a function or something in XSLT or XSL-FO to make data from
an XML-file uppercase?
I ask this becouse I have a XML-document with <title>whatever </title>
tags, and i want the data to appear in uppercase in the final
PDF-document.
There are some fonts that display upper case characters for both upper
and lower case characters.
Alternatively use the translate() function from XPath.
With this XML,
- - -
<doc>
<title>Hello, world!</title>
</doc>
- - -
this transformation,
- - -
<xsl:styleshe et
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="ye s"/>
<xsl:template match="/doc">
<xsl:value-of select="transla te(title,
'abcdefghijklmn opqrstuvwxyz',
'ABCDEFGHIJKLMN OPQRSTUVWXYZ')"/>
</xsl:template>
</xsl:stylesheet>
- - -
gives the result
- - -
HELLO, WORLD!
- - -
A neater way to do it if you have more than one occasion to upcase
things is to define entities as follows:
- - -
<!DOCTYPE xsl:stylesheet [
<!ENTITY lower "abcdefghijklmn opqrstuvwxyz">
<!ENTITY upper "ABCDEFGHIJKLMN OPQRSTUVWXYZ">
]>
<xsl:styleshe et
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="ye s"/>
<xsl:template match="/doc">
<xsl:value-of select="transla te(title,&lower ;,&upper;)"/>
</xsl:template>
</xsl:stylesheet>
- - -
Ben
--
Ben Edgington
Mail to the address above is discarded.
Mail to ben at that address might be read.
http://www.edginet.org/