[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: commenting an XML element [XSLT 1.0][xsltproc]
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|