Subject: RE: [xsl] Whitespace question From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Tue, 18 Sep 2001 09:10:41 +0100 |
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@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Ragulf > Pickaxe > Sent: 18 September 2001 07:25 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Whitespace question, Christopher R. Maden | Thread | Re: [xsl] Whitespace question, Ragulf Pickaxe |
RE: [xsl] How does one go about ext, Swen Thuemmler | Date | Re: [xsl] How do you get the non-tr, Francis Norton |
Month |