xsl-list
[Top] [All Lists]

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

2005-05-26 03:22:23
You can put xml:space="preserve" anywhere in a stylesheet (it affects all
text node descendants of that element), but as I say, I wouldn't recommend
it. I mentioned it as a possible explanation of the problems this poster was
having.

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

-----Original Message-----
From: Mukul Gandhi [mailto:mukul_gandhi(_at_)yahoo(_dot_)com] 
Sent: 26 May 2005 10:05
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] How to trim leading and trailing spaces in 
xsl:attribute?

Hi Mike,
  Where we must specify xml:space="preserve" attribute
(to preserve whitespace only text nodes in
stylesheet)?

Would it be at this tag -
<xsl:stylesheet xml:space="preserve" ...

Regards,
Mukul

--- Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
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(_dot_)karr(_at_)wamu(_dot_)net] 
Sent: 25 May 2005 18:41
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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.



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--