W3C home > Mailing lists > Public > xsl-editors@w3.org > January to March 2002

RE: serializing nodes as text or as comment

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Wed, 30 Jan 2002 16:09:54 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210602679BE5@daemsg02.software-ag.de>
To: "'Oliver Becker'" <obecker@informatik.hu-berlin.de>, xsl-editors@w3.org
> it would be fine if there's an easy to create comments like
> <!-- Processing: <a>text</a><a>text</a> -->

Yes. Of course, there is no way that comments can have element children in
the result tree, which makes this awkward.

A suggestion that's been made is to have functions parse() and serialize().
Parse take a string containing an XML document and returns its tree;
serialize() does the reverse. Then you could do:

<xsl:comment><xsl:copy-of select="serialize($set)"/></xsl:comment> 

Trouble is, we can go on inventing nice functions like this for ever. One
has to draw the line somewhere; the only problem is knowing where to draw
it.

Mike Kay

> Rationale: I would like to do some debugging and add parameter values
> (which could be node-sets) to the output - ideally as comments.
> Well, I could write my own serializer (templates which produce
> angle brackets and tag names) but that's a bit overkill for 
> my purpose.
> 
> If the XSLT processor would do the job
> <xsl:comment><xsl:copy-of select="$set"/></xsl:comment>
> that would be very simple and convenient.
> The same with text nodes:
> <xsl:text><xsl:copy-of select="$set"/></xsl:text>
> could produce a text node with the serialized content of $set.
> 
> Well, I recognize that the responsibilities for the processor 
> (dealing with nodes) and the serializer (producing output) 
> would be mixed.
> Just a thought ...
> 
> Cheers,
> Oliver
> 
> 
> /-------------------------------------------------------------------\
> |  ob|do        Dipl.Inf. Oliver Becker                             |
> |  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
> |  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
> \-------------------------------------------------------------------/
> 
Received on Wednesday, 30 January 2002 10:09:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:52 GMT