[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|