[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Space Between 2 consecutive Nodes
Subject: Re: [xsl] Space Between 2 consecutive Nodes From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 31 Jul 2002 09:20:49 +0100 |
Hello Kumar, > Below line present my XML file. > > <Para>This is Example <Italic>Italic Text</Italic> <Bold>Bold > Text</Bold> Text</Para> > > I am using MSXML3. When i start the transforming the above into > HTML, i am getting the below output. > > This is Example Italic TextBold Text Text. > > In the above output, space between 2 consecutive nodes (i.e. > <italic> & <bold>) is dropped. > > But i need, > > This is Example Italic Text Bold Text Text. This is because of MSXML's annoying (and arguably non-conformant) habit of stripping whitespace-only text nodes (text nodes that consists purely of whitespace) whether you want it to or not. By the time the information about the XML document gets through to the XSLT processor within MSXML, the space between the Italic and Bold elements doesn't exist any more, so there's nothing you can do within the XSLT to change it. There are two options. The best is to tell MSXML not to strip whitespace-only text nodes by controlling the transformation through a script and in that script setting the .preserveWhiteSpace property of the DOM that holds the source XML file to true. Alternatively, you could change the XML source and include an xml:space attribute on the Para element, as follows: <Para xml:space="preserve">This is Example <Italic>Italic Text</Italic> <Bold>Bold Text</Bold> Text</Para> 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] less than zero, David Carlisle | Thread | RE: [xsl] Space Between 2 consecuti, Michael Leditschke |
Re: [xsl] Which namespace to use, James Fuller | Date | [xsl] Please help, aruniima . chakrabar |
Month |