Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Q: strip white space

Reply
Thread Tools

Q: strip white space

 
 
Malcolm Dew-Jones
Guest
Posts: n/a
 
      04-12-2005
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.
 
Reply With Quote
 
 
 
 
David Carlisle
Guest
Posts: n/a
 
      04-12-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) (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 xslreserve-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
 
Reply With Quote
 
 
 
 
Malcolm Dew-Jones
Guest
Posts: n/a
 
      04-13-2005
David Carlisle ((E-Mail Removed)) wrote:
: (E-Mail Removed) (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 xslreserve-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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strip all but second second line from bottom and then strip that!!!! yelipolok Perl Misc 4 01-27-2010 08:14 AM
What is the C++ idiom to strip leading and lagging white space from astring? Ramon F Herrera C++ 15 09-09-2009 07:15 AM
Any programs to trim white space/ remove all white space in HTML file? Ben C HTML 6 01-28-2007 11:41 PM
strip and its evil brother strip! Aquila Ruby 35 03-31-2005 04:10 AM
Stack space, global space, heap space Shuo Xiang C Programming 10 07-11-2003 07:30 PM



Advertisments