473,411 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 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 12609
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 have an XSLT file which should be transforming a...
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 by version 1 of XSLT processor and the other by...
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 info about bank accounts like this: (...) <acc...
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 client (browser). But, the XSLT transormation...
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: .... xmlItems.Document = pmXML // Add the pmID...
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 so that editing was very easy and less time...
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' element. i.e. for each <featuresI would like to...
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 example This is when you want to put dynamic values...
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 name="batboy.wks" size="424" ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.