Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 9th, 2006, 01:55 PM
Registered User
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default upper casing values

Is there a way in an xsl template to force uppercase on values? For example, during a transformation, I want to upper case the title attribute:

<xsl:element name="book">
   <xsl:attribute name="title">
      <xsl:value-of select="@book-title"/>

So if I had an XML document like this:
<book book-title="minority report"/>

I want the transformation to do this:
<book title="MINORITY REPORT"/>

Thanks in advance.


Old November 9th, 2006, 02:03 PM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Check out the translate function if using version 1.0 or the upper-case function if using version 2.0.


Joe (Microsoft MVP - XML)
Old November 9th, 2006, 02:12 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

In 2.0, use the upper-case() function.

In 1.0, use translate($in, 'abcdef...z', 'ABCDEF...Z')

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT Help to get value from Upper Node by compare pixelheart XSLT 10 May 1st, 2008 12:25 PM
Fitting a Motherboard to a casing crmpicco HTML Code Clinic 2 October 17th, 2005 05:47 AM
upper limit crmpicco Javascript How-To 2 October 4th, 2005 04:02 AM
first character as Upper Case crmpicco VB How-To 4 July 1st, 2005 01:35 PM
SELECT UPPER ciko1973 Classic ASP Databases 4 July 7th, 2003 04:46 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.