[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]

Subject: Re: commenting an XML element [XSLT 1.0][xsltproc]
From: pankaj.c@xxxxxxxxxxxxxxxxxx
Date: Wed, 18 Aug 2010 18:16:59 +0530
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" 

    <!--Identity transform copies all items by default -->
    <xsl:template match="@* | node()">
            <xsl:apply-templates select="@*|node()"/>

    <xsl:template match="colspec">
            <xsl:apply-templates select="self::*" mode="comment" />

    <xsl:template match="*" mode="comment">
        <xsl:value-of select="'&lt;'"/>
            <xsl:value-of select="name()"/>
        <xsl:value-of select="'&gt;'"/>
            <xsl:apply-templates select="@*|node()" mode="comment" />
        <xsl:value-of select="'&lt;/'"/>
            <xsl:value-of select="name()"/>
        <xsl:value-of select="'&gt;'"/>

    <xsl:template match="text()" mode="comment">
        <xsl:value-of select="."/>

    <xsl:template match="@*" mode="comment">
        <xsl:value-of select="name()"/>
        <xsl:value-of select="."/>
        <xsl:text>" </xsl:text>


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 -->
<table id="t0010" frame="topbot" rowsep="0" colsep="0">
<label>Table 3-1</label>
<simple-para id="sp0200" role="title">This is a dummy title.</simple-para>
<simple-para id="sp0210">Ranjan</simple-para>
<source>Source if present.</source>
<tgroup cols="2">
<colspec colname="col1"/>
<colspec colname="col1"/>
<colspec colname="col2"/>
<thead valign="top">
<entry rowsep="1" align="left">Abbreviation</entry>
<entry rowsep="1" align="left">Dosage Interval</entry>
<!-- More code here 

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.