Works for me now too. Yesterday was not my day. Little bit of tweaking in
stylesheet and I got the result the way I wanted (as an EMPTY element).
<!--<colspec colname="col1"/>-->
<!--<colspec colname="col2"/>-->
<?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>
<!-- Comment <colspec> element, which will require during export -->
<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:text> </xsl:text>
<xsl:apply-templates select="@*|node()" mode="comment" />
<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:text>/</xsl:text>
</xsl:template>
</xsl:stylesheet>
But what about <thead valign="top">, which contains child elements and I
wish to comment *only* <thead>.
<thead valign="top">
<row>
<entry rowsep="1" align="left">Abbreviation</entry>
<entry rowsep="1" align="left">Dosage Interval</entry>
</row>
</thead>
to
<!-- <thead valign="top"> -->
<row>
<entry rowsep="1" align="left">Abbreviation</entry>
<entry rowsep="1" align="left">Dosage Interval</entry>
</row>
<!--</thead> -->
<xsl:template match="thead">
<xsl:comment>
<xsl:apply-templates select="." mode="comment" />
</xsl:comment>
</xsl:template>
The above code does not seems to be working.
Secondly how about reverting *commented* element using stylesheet. Is
there a way around.
Can somebody throw some ideas.
Best,
Pankaj
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--