Subject: Re: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Normalize-space does not , Michael Kay | Thread | RE: [xsl] Normalize-space does not , Oliver Becker |
RE: [xsl] XSL v. XSLT, DPawson | Date | Re: [xsl] parent and .., David Carlisle |
Month |