You haven't shown the xsl:output declaration. If the selected encoding is one that doesn't include the euro symbol - for example iso8859-1 - then it won't be possible to output a comment containing this symbol. That's because encoding it as a numeric character reference doesn't work - entities and character references are not recognized inside comments.
 
The best solution would be to change the output encoding to UTF-8.
 
Michael Kay
http://www.saxonica.com/


From: Philippe Drix [mailto:philippe.drix@graphane.com]
Sent: 20 February 2009 14:33
To: saxon-help@lists.sourceforge.net
Subject: [saxon] odd encoding error in comment

Hi,

I have a strange error with Saxon 9 and Saxon 8.

Here my xsl :

<xsl:template match="child::node()|attribute::*" priority="-10">
         <xsl:copy>
                  <xsl:apply-templates select="attribute::*" />
                  <xsl:apply-templates select="child::node()"/>
         </xsl:copy>
</xsl:template>

(nothing more is usefull to understand the problem).


Here my XML data :

<?xml version="1.0" encoding="UTF-8"?>
<data>
        <!-- <MontantAideTotal>0,00 €</MontantAideTotal> -->
         <bloc-TotalAPayerEssai>
                 
         </bloc-TotalAPayerEssai>
</data>

Here what I get when running Saxon (9 or 8) :

Error at xsl:apply-templates on line 71 of file:/D:/test-encoding/remove-fields.xsl:
  SERE0008: Character in comment cannot be represented in the selected encoding (code 8364)
Transformation failed: Run-time errors were reported

Now, if I drop the <!-- and --> to remove the comment, all is fine !!!

And if I remove only the Euro symbol (without removing the comment, as below), no error !

<?xml version="1.0" encoding="UTF-8"?>
<data>
        <!-- <MontantAideTotal>0,00</MontantAideTotal> -->
         <bloc-TotalAPayerEssai>
                 
         </bloc-TotalAPayerEssai>
</data>


Any idea ?

Regards -- Ph D





--
==================================================
Philippe Drix -- R&D
Graphane Solutions

mobile : 06 74 78 34 97
fixe   : 02 41 22 10 11

www.graphane.com