xsl-list
[Top] [All Lists]

Re: [xsl] commenting Parent element only

2010-09-18 12:01:04
pankaj(_dot_)c(_at_)thomsondigital(_dot_)com wrote:

Input
====

<row>
<entry align="left">s.i.d.<cross-ref refid="tbl6fn1"><sup>*</sup></cross-ref></entry>
<entry align="left">Once daily</entry>
</row>
<row>
<entry align="left">b.i.d.</entry>
</row>

Output required
============

<!--<row>-->
<entry align="left">s.i.d.<cross-ref refid="tbl6fn1"><sup>*</sup></cross-ref></entry>
<entry align="left">Once daily</entry>
<!--</row>-->
<!--<row>-->
<entry align="left">b.i.d.</entry>
<!--</row>-->

I tried =====
<!--  Comment <row> element, which will require later on  -->
    <xsl:template match="row">
        <xsl:comment>
            <xsl:apply-templates select="." mode="comment_element" />
        </xsl:comment>
    </xsl:template>

you rather need
      <xsl:template match="row">
         <xsl:comment>
           <xsl:apply-templates select="." mode="start-tag"/>
         </xsl:comment>
         <xsl:copy-of select="node()"/>
         <xsl:comment>
           <xsl:apply-templates select="." mode="end-tag"/>
         </xsl:comment>
      </xsl:template>
where the mode="start-tag" then serializes the element and its attributes for the start tag and the mode="end-tag" serializes the end tag.



--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>