This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Whitespace question
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Whitespace question
- From: "Ragulf Pickaxe" <jawxml at hotmail dot com>
- Date: Tue, 18 Sep 2001 13:07:56 +0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
>In order to distinguish these two cases, you *must* preserve spaces. Once
>the space is stripped, they are identical, and no amount of XSLT wrangling
>will help.
>
>Your options are (1) xml:space="preserve" in the original XML, (2)
>xsl:preserve-space in the XSLT, or (3) some switch to MSXML itself before
>beginning the transformation.
I will try to look a litle into Michael Kay's solution, then.
The problem, though, is that I only want ' ' preserved, not linefeed and all
that kind of things - these are tagged in the xml document:
<Doc>
<P>This is the document with a line feed<Newline/>so this will be on a
new line, but not<NBSP/>
this, which will be on the same line<Bold> Bold text</Bold> <Italic>Italic
text, which will be place besides "Bold text" because of the 'whitespace
problem'</Italic></P>
</Doc>
I search for NBSP, Newline, Bold, Italic and such and use the appropriate
action to get the right output.
Example:
<xsl:template match="Bold">
<B><xsl:apply-templates /></B>
</xsl:template>
Therefore, preserving whitespace, like what was suggested in Michael Kay's
responce, will give other problems as well.
If I do preserve whitespace, how do I ensure that only spaces between tags
are carried over to the output document?
- I see now that I should perhaps have been more informative in my first
mail, but I tried to keep it short.
Ragulf Pickaxe
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list