Subject: Re: [xsl] commenting an XML element [XSLT 1.0][xsltproc] From: pankaj.c@xxxxxxxxxxxxxxxxxx Date: Wed, 18 Aug 2010 18:16:59 +0530 |
Thanks again Martin for looking into it. I tried testing it with below stylesheet, now complete one but with same error. Something is terribly missing in code. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!--Identity transform copies all items by default --> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="colspec"> <xsl:comment> <xsl:apply-templates select="self::*" mode="comment" /> </xsl:comment> </xsl:template> <xsl:template match="*" mode="comment"> <xsl:value-of select="'<'"/> <xsl:value-of select="name()"/> <xsl:value-of select="'>'"/> <xsl:apply-templates select="@*|node()" mode="comment" /> <xsl:value-of select="'</'"/> <xsl:value-of select="name()"/> <xsl:value-of select="'>'"/> </xsl:template> <xsl:template match="text()" mode="comment"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="@*" mode="comment"> <xsl:value-of select="name()"/> <xsl:text>="</xsl:text> <xsl:value-of select="."/> <xsl:text>" </xsl:text> </xsl:template> </xsl:stylesheet> Just for reference, below is the sample xml <?xml version="1.0" encoding="UTF-8"?> <!-- New document created with EditiX at Wed Aug 18 17:37:11 IST 2010 --> <root> <table id="t0010" frame="topbot" rowsep="0" colsep="0"> <label>Table 3-1</label> <caption> <simple-para id="sp0200" role="title">This is a dummy title.</simple-para> <simple-para id="sp0210">Ranjan</simple-para> </caption> <source>Source if present.</source> <tgroup cols="2"> <colspec colname="col1"/> <colspec colname="col1"/> <colspec colname="col2"/> <thead valign="top"> <row> <entry rowsep="1" align="left">Abbreviation</entry> <entry rowsep="1" align="left">Dosage Interval</entry> </row> </thead> <!-- More code here --> </tgroup> </table> </root>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] commenting an XML element, Martin Honnen | Thread | Re: [xsl] commenting an XML element, Martin Honnen |
Re: [xsl] commenting an XML element, Martin Honnen | Date | Re: [xsl] commenting an XML element, Martin Honnen |
Month |