RE: serializing nodes as text or as comment

> 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 UTC