xsl-list
[Top] [All Lists]

RE: about & ...

2003-06-20 08:30:13
[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 & Drink', '&','')

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(.,'&', '')

Cheers,

Tom P

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



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