469,306 Members | 1,881 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

uppercase in XSLT/XSL-FO

Hi all,

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.

Thanks for any help
Jul 20 '05 #1
3 12245
On Wed, 01 Oct 2003 01:38:38 -0700, Jurrie wrote:
Hi all,

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.


this is not an XSLT, but an XPath issue. there are several xpath string
functions, that can easily be found in the XPath standard

http://www.w3.org/TR/xpath#section-String-Functions

look for the translate function. this will solve your problem.

alex
Jul 20 '05 #2
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.

--
Ron

Jul 20 '05 #3
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:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output omit-xml-declaration="yes"/>

<xsl:template match="/doc">
<xsl:value-of select="translate(title,
'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
</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 "abcdefghijklmnopqrstuvwxyz">
<!ENTITY upper "ABCDEFGHIJKLMNOPQRSTUVWXYZ">
]>

<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output omit-xml-declaration="yes"/>

<xsl:template match="/doc">
<xsl:value-of select="translate(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/
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Pete | last post: by
2 posts views Thread by Sven | last post: by
8 posts views Thread by Maciej Wegorkiewicz | last post: by
7 posts views Thread by Harolds | last post: by
1 post views Thread by Nick | last post: by
1 post views Thread by Sandeep Singh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.