RE: [xsl] How to trim leading and trailing spaces in xsl:attribute?

Subject: RE: [xsl] How to trim leading and trailing spaces in xsl:attribute?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 26 May 2005 09:29:15 +0100
You can write

<xsl:attribute name="x">
  <xsl:value-of select="abc"/>
</xsl:attribute>

Whitespace-only text nodes in a stylesheet are ignored, unless you specify
xml:space="preserve" (which I wouldn't recommend).

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Karr, David [mailto:david.karr@xxxxxxxx] 
> Sent: 25 May 2005 18:41
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] How to trim leading and trailing spaces in 
> xsl:attribute?
> 
> I have an "<xsl:attribute>" element in my stylesheet, and its value is
> an "<xsl:value-of>" reference which then calls an XPATH function.  The
> resulting single line is a little ugly.  I'd like to format 
> the line so
> it's a little more readable.  Unfortunately, I appear to be limited by
> the semantics of the "<xsl:attribute>" element.  It does not trim
> leading and trailing spaces, and it encodes any newlines found in the
> resulting value.
> 
> I'm using JDK 1.4.2, in case there are constraints in the native TRAX
> implementation inherent in that.

Current Thread