Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Strip comments from XML documents

Reply
Thread Tools

Strip comments from XML documents

 
 
CI
Guest
Posts: n/a
 
      01-11-2006
I have to create a new XML document from the exising one, by adding
some additional tags, etc..

My question is as follows: how to strip XML comments from the existing
document?

The identity tranform below copies all the nodes, including comment
nodes.


<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" indent="yes"/>

<xsl:template match="node( ) | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node( )" />
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

Thanks in Advance

Michael

 
Reply With Quote
 
 
 
 
CI
Guest
Posts: n/a
 
      01-11-2006
Thanks Soren. It did the trick.

Michael.

 
Reply With Quote
 
 
 
 
Soren Kuula
Guest
Posts: n/a
 
      01-11-2006
CI wrote:
> I have to create a new XML document from the exising one, by adding
> some additional tags, etc..
>
> My question is as follows: how to strip XML comments from the existing
> document?
>
> The identity tranform below copies all the nodes, including comment
> nodes.
>
>
> <xsl:stylesheet version="1.0"
> xmlnssl="http://www.w3.org/1999/XSL/Transform">
> <xslutput method="xml" indent="yes"/>
>
> <xsl:template match="node( ) | @*">
> <xsl:copy>
> <xsl:apply-templates select="@* | node( )" />
> </xsl:copy>
> </xsl:template>


<xml:template match="comment()"/>

> </xsl:stylesheet>
>
> Thanks in Advance
>
> Michael
>

Soren
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strip all but second second line from bottom and then strip that!!!! yelipolok Perl Misc 4 01-27-2010 08:14 AM
How to strip ruby comments in a ruby line of code? Alexandre Mutel Ruby 16 11-19-2009 04:55 PM
How to strip comments out of code silviocortes@yahoo.com Java 19 11-02-2007 08:06 AM
strip and its evil brother strip! Aquila Ruby 35 03-31-2005 04:10 AM
Strip all comments KiwiBrian HTML 6 07-23-2004 06:28 PM



Advertisments