[xsl] Best way of preserving comments?

Subject: [xsl] Best way of preserving comments?
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Wed, 3 Apr 2013 15:08:54 +0200
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