[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Normalize-space does not work for node generated f

Subject: Re: Normalize-space does not work for node generated from msxml:node-set function
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 19 Mar 2002 09:37:35 +0000
tennison normalize space
Hi Malcolm,

> Normalised text from node-set function - spaces not preserved
> ABC
> Normalised text from XML nodes - spaces are preserved
> A B C
>
> Can anyone explain this?

Mike's explained why you aren't getting whitespace when you convert
from the result tree fragement (because whitespace is always stripped
from the stylesheet).

If you want to *add* whitespace to the result tree fragment, so that
the two trees are the same when normalized, then you can add an
xml:space attribute to the ANode element, with a value 'preserve':

  <xsl:variable name="XSLData">
    <ANode xml:space="preserve">
      <ChildNode>A</ChildNode>
      <ChildNode>B</ChildNode>
      <ChildNode>C</ChildNode>
    </ANode>
  </xsl:variable>

That way, the whitespace-only text nodes are retained in the
stylesheet, and thus in the result tree fragment.

If you want to *remove* whitespace from the normal source document
(and the result tree fragment), then you can strip it with the
xsl:strip-space element:

<xsl:strip-space elements="*" />

That way, documents won't contain whitespace-only text nodes in the
first place.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.