472,353 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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 12452
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I...
2
by: Sven | last post by:
Hi I have the following XML & XSLT: XML: <?xml version="1.0" encoding="utf-8"?> <Source Source="IBM"> <Detail> <UserID></UserID>
1
by: Mohit | last post by:
Hi Friends I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed...
8
by: Maciej Wegorkiewicz | last post by:
Hi, I have small experience in XSLT processing and I have a problem which I cannot solve. Can you look at it? I have an input file containing...
12
by: gipsy boy | last post by:
Hello, I have sort of a big problem. I would really appreciate any help you could give me. I made a web service in C++ that throws XML to the...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .......
1
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML...
18
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features'...
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and...
1
by: Sandeep Singh | last post by:
Hi, How to do group by in XSLT ? I tried on the following codes: <files> <file name="swablr.eps" size="4313" project="mars"/> <file...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.