By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,314 Members | 1,745 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,314 IT Pros & Developers. It's quick & easy.

Q: strip white space

P: n/a
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.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
yf***@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
Jul 20 '05 #2

P: n/a
David Carlisle (da****@nag.co.uk) wrote:
: yf***@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.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.