Re: How to extract comments only?

Subject: Re: How to extract comments only?
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 26 Jun 2000 14:05:14 -0600 (MDT)
> I'm still new to XSLT, but have a need to
> extract all comments (however deep) from an
> XML file to another. Output should only
> contain comments and nothing else perhaps
> save the XML declaration (i.e: none
> of the other markup/pcdata).

Sure. Read and then it should be
apparent why this simple stylesheet will (well, should) do what you want:

<?xml version="1.0"?>
<xsl:stylesheet xmlns=""; version="1.0">

<xsl:template match="comment()">

<xsl:template match="text()|@*"/>


   - Mike
Mike J. Brown, software engineer at         My XML/XSL resources: in Denver, Colorado, USA 

 XSL-List info and archive:

Current Thread