Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: The normalize-space

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent