![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - The normalize-space >Thread Next - Re: The normalize-space Re: The normalize-spaceTo: NULL Date: 12/12/2006 2:16:00 PM kollatjorva@g... wrote: > I'm trying to get a value from an xml node 'Publisher' use the value as > a name of an .css class. This works fine until I get a value from the > Publisher node with white space in it. > I've been trying to use normalize-space function on this but I can't > make this work > > here is what I'm trying to do > > <xsl:attribute name="class">color<xsl:value-of > select="normalize-space(Publisher)"/></xsl:attribute> CSS class names can't contain white space, if you end up with e.g. <div class="class name"> then the div elements belongs to two classes, one with name "class", the second with name "name". If you want to strip spaces from Publisher then use e.g. <xsl:attribute name="class">color<xsl:value-of select="translate(Publisher, ' ', '')"/></xsl:attribute> If you want to use '-' instead of space then you could do e.g. <xsl:attribute name="class">color<xsl:value-of select="translate(normalize-space(Publisher), ' ', '-')"/></xsl:attribute> -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
