[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Newbie question, commenting out an element
Subject: Re: [xsl] Newbie question, commenting out an element From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Sun, 21 Dec 2008 15:22:13 +0530 |
The following works fine with Saxon 9. <xsl:output name="ser-x" method="xml" omit-xml-declaration="yes" indent="yes" /> <xsl:comment> <xsl:value-of select="saxon:serialize(applic, 'ser-x')" /> </xsl:comment> I have few questions, 1. Can we have serialize functionality in a future XSLT version (perhaps 2.1), something like, xsl:serialize(...) which exactly follows the Saxon serialize extension semantics? saxon:serialize seems to me a quite useful extension, and I think it could be available in standard XSLT. 2. XSLT 2.0 allows us to define xsl:output elements with 'name' attribute, which can be used in saxon:serialize function (as shown above). Apart from saxon:serialize function, do any standard XSLT 2.0 instructions/facilities use xsl:output elements having 'name' attribute? On Sun, Dec 21, 2008 at 3:02 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote: >> >> I am new to the list and to XSLT. I want to transform a XML >> file to another XML file. In the process I have a Applic tag >> that I want to wrap in a comment. > > Comments can't contain tags. If you look at XML more carefully, you will see > that any "<" and ">" characters are not treated as markup (or tags), they > are ordinary data characters. They might look like tags, but the appearance > is deceptive. > > This is reflected in the XSLT/XPath data model: a comment node cannot have > element nodes as its children. > > So to solve this, you need to serialize the elements as strings, and then > put the strings in the comment node. You can do the serialization by hand > (but be careful with special characters like "&"), or use something like > saxon:serialize(). > > Michael Kay > http://www.saxonica.com/ -- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Newbie question, commenti, Michael Kay | Thread | Re: [xsl] Newbie question, commenti, Martin Honnen |
RE: [xsl] Newbie question, commenti, Michael Kay | Date | Re: [xsl] Newbie question, commenti, Martin Honnen |
Month |