This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: copy top-level comments
- To: "Dimitre Novatchev" <dnovatchev at yahoo dot com>
- Subject: [xsl] Re: Re: copy top-level comments
- From: "Rob Lugt" <roblugt at elcel dot com>
- Date: Tue, 19 Jun 2001 14:24:24 +0100
- Cc: <xsl-list at lists dot mulberrytech dot com>
- References: <20010619125155.38312.qmail@web14505.mail.yahoo.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Yes, I see MSXML is not at fault.
Using Saxon (my processor of choice), the indent="yes" does not have this
effect. I have now read the page in Mike's book and I stand corrected.
~Rob
----- Original Message -----
From: "Dimitre Novatchev" <dnovatchev@yahoo.com>
To: <roblugt@elcel.com>
Cc: <xsl-list@lists.mulberrytech.com>
Sent: Tuesday, June 19, 2001 1:51 PM
Subject: Re: Re: copy top-level comments
> Hi Rob,
>
> The behaviour of MSXML has nothing to do with interpreting the space
between the
> comments -- even when this space forms "whitespace-only" nodes as per
spec, in MSXML
> such nodes are discarded by default on reading the input.
>
> So, when I removed the 'indent="yes" ' from the xsl:output, I got the
following
> result:
>
> <!--comment1 --><!--comment2 --><!-- comment1 ok --><!-- comment2 ok -->
>
> So, this proves that it is the way hoe MSXML interprets 'indent="yes" '.
>
> In Mike Kay's book (page 256) it is said that this behaviour is not
well-defined and
> therefore may be vendour-specific.
>
> Cheers,
> Dimitre Novatchev.
>
> Rob Lugt wrote:
>
> Dimitre Novatchev wrote:
> >
> > > I want to copy comments from the input to the output.
> > > I try to get each command in a new Line as it is in the input
document.
> > > <xsl:output method="xml" inden="yes"> works for the most comments, but
> not for the
> > > top.Level comments.
> >
> > Using MSXML I cannot reproduce the problem:
> >
> > source xml:
> > -----------
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <!--comment1 -->
> > <!--comment2 -->
> > <doc>
> > <!-- comment1 ok -->
> > <!-- comment2 ok -->
> > </doc>
> >
>
> I'm afraid this looks like a non-conformance issue with MSXML. The space
> between the comments in the root node is not XML character data, and
> therefore I don't think it should be presented to the XSLT processor as
> such.
>
> However, it is possible to achieve what Bernward wanted with a modified
> stylesheet:-
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method="xml" indent="yes"/>
>
> <xsl:template match="/comment()">
> <xsl:text> </xsl:text> <!-- force a linefeed before each
> top-level comment -->
> <xsl:copy/>
> </xsl:template>
>
> <xsl:template match="comment()">
> <xsl:copy/>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Regards,
> Rob
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Spot the hottest trends in music, movies, and more.
> http://buzz.yahoo.com/
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list