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

RE: about & ...

Subject: RE: about & ...
From: Stuart Brown <sbrown@xxxxxxxxxxx>
Date: Fri, 20 Jun 2003 15:31:04 +0100
translate xslt
Hi,

If you're saying that your XML file actually has, for instance,
<item>Food & Drink</item>
then this is not valid XML, and the XSLT processor will be throwing your
input file out before it even starts thinking about doing the
transformation.

This is pre-XSLT, basic XML rules, I'm afraid.

Regards,

Stuart

-----Original Message-----
From: Fei Zheng [mailto:Fei.Zheng@xxxxxxx]
Sent: 20 June 2003 15:18
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  about & ...


"Food & Drink" is what I have in the xml file. I should have made it
clearer. 

item is a element which has a value of "Food & Drink" in the xml file.

It will never replace '&' into '' if I have -- translate(item, 'amp;', ''); 




-----Original Message-----
From: Stuart Brown [mailto:sbrown@xxxxxxxxxxx]
Sent: Friday, June 20, 2003 9:45 AM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE:  about & ...


XSLT is expressed in XML, and so must conform to all the XML rules,
including the fact that "&" is a forbidden character used only to mark the
start of an entity and must be represented with "&amp;".

translate('Food &amp; Drink','&amp; ','')

Note I've also added the space in the second argument so these are replaced
as well to provide "FoodDrink".

To pre-empt your next question, the use of &amp; is required in the
serialized XML document. The above function will not translate each
individual character of '&','a','m', etc. to '', because an XSLT stylesheet
is parsed like any other XML document prior to processing, and so the XSLT
engine itself will understand it as '&' --> ''.

Regards,

S

-----Original Message-----
From: Fei Zheng [mailto:Fei.Zheng@xxxxxxx]
Sent: 20 June 2003 14:40
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  about & ...


I'd like to translate "Food & Drink" into "FoodDrink". 

I use this:   translate('Food & Drink',  '&',  '' );

Apparently, an error occurs with the code above because of the '&'. Can
anyone tell how to handle the '&' here?  

Thanks in advance.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.