Q: strip white space

Discussion in 'XML' started by Malcolm Dew-Jones, Apr 12, 2005.

  1. 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.
     
    Malcolm Dew-Jones, Apr 12, 2005
    #1
    1. Advertising

  2. (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
     
    David Carlisle, Apr 12, 2005
    #2
    1. Advertising

  3. David Carlisle () wrote:
    : (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.
     
    Malcolm Dew-Jones, Apr 13, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    1,708
    William Park
    May 10, 2005
  2. Ben C
    Replies:
    6
    Views:
    2,193
    Leif K-Brooks
    Jan 28, 2007
  3. Ramon F Herrera
    Replies:
    15
    Views:
    1,046
    Francesco
    Sep 9, 2009
  4. Aquila
    Replies:
    35
    Views:
    484
    Mathieu Bouchard
    Mar 31, 2005
  5. yelipolok
    Replies:
    4
    Views:
    277
    John W. Krahn
    Jan 27, 2010
Loading...

Share This Page