[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Best way of preserving comments?

Subject: Best way of preserving comments?
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Wed, 3 Apr 2013 15:08:54 +0200
 Best way of preserving comments?
Using XSLT 2, this combination:

 <xsl:strip-space elements = "*" />
 <xsl:template match="element()|attribute()">... skip selected *|@* ... />
 <xsl:template match="text()|@_ix">
   <xsl:copy-of select="."/>
 </xsl:template>
 <xsl:template match="comment()">
   <xsl:copy-of select="."/><xsl:text>
</xsl:text>
 </xsl:template>

is the best I could do to preserve the original comment and element
layout, shown with beginning of input and output XML, below. Can this
be improved? Losing empty lines is tolerable, losing line breaks is
not so great.

Thanks
Wolfgang

Beginning of input XML:
=============================================
<ns2:cca_rom_db xmlns:ns2="/rss/at/obb/cca" version="0.1">


<!-- changing: processor_data (0) -->
<!-- .    OREST Problem -->
<!-- .    check this hex values !!!!!!!!!!!!!!!! -->
<processor_data _ix="0" reo_bos_zentrale="----" />


<!-- __________CCA-patches IRT_______________ -->
<!-- changing: versions -->
<!-- .    not provided by OREST - done to minimize differences -->


<!-- changing: pcx_info -->
<!-- .    OREST - station time missing -->
<pcx_info _ix="1" ... />
===========================================

Head of output XML:
============================================
<ns2:cca_rom_db xmlns:ns2="/rss/at/obb/cca"><!-- changing:
processor_data (0) -->
<!-- .    OREST Problem -->
<!-- .    check this hex values !!!!!!!!!!!!!!!! -->
<processor_data _ix="0" reo_bos_zentrale="----"/>
   <!-- __________CCA-patches IRT_______________ -->
<!-- changing: versions -->
<!-- .    not provided by OREST - done to minimize differences -->
<!-- changing: pcx_info -->
<!-- .    OREST - station time missing -->
<pcx_info _ix="1" ... />
===========================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.