xsl-list
[Top] [All Lists]

RE: about & ...

2003-06-20 07:32:24
translate(item, '& ', '');

Gertjan Assies

 

-----Original Message-----
From: Fei Zheng [mailto:Fei(_dot_)Zheng(_at_)sas(_dot_)com] 
Sent: Friday, June 20, 2003 4:18 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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(_at_)extenza(_dot_)com]
Sent: Friday, June 20, 2003 9:45 AM
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] 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 "&".

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

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 & 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(_dot_)Zheng(_at_)sas(_dot_)com]
Sent: 20 June 2003 14:40
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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




BackStream(R)
Willem de Zwijgerlaan 350-352
1055 RD Amsterdam
The Netherlands
tel. +31 20 386 8365
fax +31 20 386 8948 

Post Office Address: 
Postbus 58385
1040 HJ Amsterdam

BackStream: The Digital Delivery Company
www.backstream.com

This e-mail and any attachment may contain confidential and privileged material 
intended for the addressee only. If you are not the addressee, you are notified 
that no part of the e-mail or any attachment may be disclosed, copied or 
distributed, and that any other action related to this e-mail or attachment is 
strictly prohibited, and may be unlawful. If you have received this e-mail by 
error, please notify the sender immediately by return e-mail, and delete this 
message. BackStream, its subsidiaries and/or its employees shall not be liable 
for the incorrect or incomplete transmission of this e-mail or any attachments, 
nor responsible for any delay in receipt.

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



<Prev in Thread] Current Thread [Next in Thread>