This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Whitespace question


The XML parser in MSXML3 drops text nodes that consist entirely of white
space unless you specify document.preserveWhitespace = true when building
the DOM, or unless you use xml:space="preserve" within the XML source. In
other words, if you are handling mixed XML content (as you are), and/or if
you want behavior that is fully conformant to the XML and XSLT
specifications, you have to set the document.preserveWhitespace property in
the API when parsing.

Mike Kay

> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Ragulf
> Pickaxe
> Sent: 18 September 2001 07:25
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Whitespace question
>
>
> Hello all,
>
> I followed the discussion of yesterday about whitespace since
> I have the
> same problem myself.
>
> I am too much a newbie for the answers to make meaning to me,
> so if I could
> get someone to explain it in details, I would be very happy.
>
> Using MSXML 3.0, I have following structure:
>
> <code1>bla bla</code1> <code1>more bla bla</code1>
>
> the <code1> tag is for internal structure and should not be
> printed out for
> the enduser to see, s/he should just see:
> bla bla more bla bla
>
> what is seen is:
> bla blamore bla bla
>
> xsl-stylesheet for this part:
> <xsl:template match="code1">
> 	<xsl:apply-templates/>
> </xsl:template>
>
> I have tried (a hack) using:
> <xsl:template match="code1">
> 	<xsl:apply-templates/>
> 	<xsl:if test="following-sibling::*[(name()='code1')][1]">
> 		<xsl:value-of select = "' '"/>
> 	</xsl:if>
> </xsl:template>
>
> But that one always sets a space, even if there is text
> between two <code1>
> tags.
>
> Dimitre Novachev wrote something about specifying
> xml:space="preserve" on an
> element - how do you do that? and would that serve the job in
> this case? If
> not, is there another way to solve the problem (and how)?
>
> Any help would be very appreciated.
>
> 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
>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]