[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: case-sensitivity in xml

Subject: Re: case-sensitivity in xml
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 21 Jan 2005 18:30:03 -0500
xml case sensitivity
Hi Rahil,

At 05:52 PM 1/21/2005, you wrote:
I am aware that XML is a case-sensitive language but is there a way to override its case-sensitivity when processing an xml document using XSLT?

Yes, but it's not pretty.


When faced with this, I have generally preprocessed the input to normalize the case of element and attribute names. So I don't have to let the case-folding logic into the main stylesheet.

In general, case-folding is done with the translate function. So if

<xsl:variable name="UPPER" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>

<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>

then translate($string,$UPPER,$lower) will convert to lower case (at least in the English/Latin alphabet).

Case-folding element and attribute names in an instance could be done with a modified identity transform and the xsl:element instruction. (Ask again if these hints are not enough to get you there.)

Also, is there a way to extract certain bits from the inner text of an xml document using XSLT such that {abc, xyz} can become abc,xyz ?

Use the translate() function for this too, only substitute the characters you don't want with the empty string:


translate($string,'{ }','') will make '{abc, xyz}' into 'abc,xyz'.

translate() is well-documented.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.