[XSL-LIST Mailing List Archive Home]
[Reply To This Message]
Re: IGNORE CASE IN XSLT
Subject: Re: IGNORE CASE IN XSLT|
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 01 Dec 2004 18:46:08 -0500
At 04:36 PM 11/26/2004, Geert wrote:
On the other hand, you could do something like:
<xsl:template match="*[translate(name(), 'ABC..', 'abc..') = 'italic']">
<!-- Yuck... -->
This will work (I think... it seems like it should but I havent tested it
to check) but the easier way to do this is to simply use the union method
for matching multiple elements:
<xsl:template match="italic | Italic">
Hope this helps!
It will not help a lot if one cannot predict the use of case in element
names. :-( Especially documents that originate from HTML of SGML have this
problem, as HTML and SGML are case insensitive...
It even gets worse if you have to account for ancestors as wel... :-(
It would have been nice if the XSL standard would have provided a case
sensitivity option. But on the other hand, it is actually more a job for
XML parsers. Are there XML Parsers that have an option to ignore case of
the input? (not using a declaration file)
Not as such (such would be an XML+ parser of a kind, not a conformant XML
processor), though you might be able to use an SGML parser.
You could run your case-folding as a pre-process (this is a simple
modification of the identity transform), but since the OP also wants to
match 'italic' to 'i', simple case-folding only gets you part of the way there.
Table-driven transforms, in which names of nodes for the result are looked
up against their names in the source (or other criterion), are also not
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format