[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: case-sensitivity in xml
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
|
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
|