Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Q: strip white space (http://www.velocityreviews.com/forums/t169149-q-strip-white-space.html)

Malcolm Dew-Jones 04-12-2005 09:59 PM

Q: strip white space
 
I am looking at xslt 1.0 and trying to understand if empty text nodes are
supposed to be stripped or not as the default behaviour.

3.4 starts by listing rules for when white space is not stripped and then
says "Otherwise the text node is stripped".

which appears to contradict a later paragraph that discusses the details
of the selection of nodes to be stripped ("Initially ... preserve ... all
element names").

xalan appears to keep white space by default, but I'm not yet familiar
enough with it to be sure I haven't invoked some white-space related
option with out realising it.

So, are empty text nodes in the xml source supposed to stripped or
preserved by default?


--

This space not for rent.

David Carlisle 04-12-2005 10:05 PM

Re: Q: strip white space
 
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:

> I am looking at xslt 1.0 and trying to understand if empty text nodes are
> supposed to be stripped or not as the default behaviour.
>
> 3.4 starts by listing rules for when white space is not stripped and then
> says "Otherwise the text node is stripped".
>
> which appears to contradict a later paragraph that discusses the details
> of the selection of nodes to be stripped ("Initially ... preserve ... all
> element names").
>
> xalan appears to keep white space by default, but I'm not yet familiar
> enough with it to be sure I haven't invoked some white-space related
> option with out realising it.
>
> So, are empty text nodes in the xml source supposed to stripped or
> preserved by default?
>
>

text nodes are never empty: if the content of an element is empty no text
node is created. by default all nodes in the source are preserved and
all white space nodes in the stylesheet are stripped unless they are
children of xsl:text. You can change these defaults with xsl:strip-space
or xsl:preserve-space declarations. (MSXML doesn't play by the rules
here and strips white space by default, losing inter-word spaces as
often as not).

David

Malcolm Dew-Jones 04-13-2005 12:03 AM

Re: Q: strip white space
 
David Carlisle (davidc@nag.co.uk) wrote:
: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:

: > I am looking at xslt 1.0 and trying to understand if empty text nodes are
: > supposed to be stripped or not as the default behaviour.
: >
: > 3.4 starts by listing rules for when white space is not stripped and then
: > says "Otherwise the text node is stripped".
: >
: > which appears to contradict a later paragraph that discusses the details
: > of the selection of nodes to be stripped ("Initially ... preserve ... all
: > element names").
: >
: > xalan appears to keep white space by default, but I'm not yet familiar
: > enough with it to be sure I haven't invoked some white-space related
: > option with out realising it.
: >
: > So, are empty text nodes in the xml source supposed to stripped or
: > preserved by default?
: >
: >
: text nodes are never empty: if the content of an element is empty no text

"empty text nodes" was a bad choice of words by me, I meant text nodes
that contain only white space.

: node is created. by default all nodes in the source are preserved and
: all white space nodes in the stylesheet are stripped unless they are
: children of xsl:text. You can change these defaults with xsl:strip-space
: or xsl:preserve-space declarations. (MSXML doesn't play by the rules
: here and strips white space by default, losing inter-word spaces as
: often as not).

Thanks.


--

This space not for rent.


All times are GMT. The time now is 01:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.