[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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" ... /> ===========================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|