RE: [xsl] about & ...

Subject: RE: [xsl] about & ...
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Fri, 20 Jun 2003 11:30:13 -0400
[Fei Zheng]
> 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?  
> 

This is XML we are using here, and a bare "&" is not legal in character
content.  So you just have to use & a m p ; (letters spaced out on
purpose here) -

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

You probably got "Food & Drink" by typing it into the stylesheet -
because a well-formed xml file cannot contain an ampersand like that -
and that made the stylesheet not well-formed, hence you got an error.
In a more realistic setting, your code would look more like this -


translate(.,'&amp;', '')

Cheers,

Tom P

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


Current Thread