Project

Profile

Help

Output character not available

Added by Anonymous over 18 years ago

Legacy ID: #3697315 Legacy Poster: Jean-Pierre Loeffel (jploeffel)

Hi, I transform xml in textile with delimiters (e.g. semicolon). Some files have special characters which Saxon “doesn’t” understand or “can’t transform”. I get the message "Output character not available in this encoding" Is there a way for Saxon to ignore them or can I replace them? I'm using Saxon 8.7.1. Here’s the stylesheet: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method = "text" encoding="ISO-8859-1" /> <xsl:template match="/"> <xsl:for-each select="product"> <xsl:call-template name="product"/> </xsl:for-each> </xsl:template> <xsl:template name="product"> <xsl:for-each select="description"> <xsl:call-template name="description"/> </xsl:for-each> </xsl:template> <xsl:template name="description"> <xsl:text>0188;</xsl:text> <xsl:value-of select = "."/> <xsl:text>;</xsl:text> <xsl:text>&#xD;&#xA;</xsl:text> </xsl:template> </xsl:stylesheet> and a sample xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <product number="123"> <description>engine with &#946;-wheels</description> </product> Thank you for your help.


Replies (1)

RE: Output character not available - Added by Anonymous over 18 years ago

Legacy ID: #3697329 Legacy Poster: Michael Kay (mhkay)

XSLT 2.0 specifies that it's a fatal error to output a character if the chosen encoding doesn't include that character. Your options are to use a different encoding or to avoid outputting the character. For example, you could define a character map that translates the character to something else. Or if you want to ignore all characters outside the Latin-1 range you could use <xsl:value-of select="replace(., '[^&amp;#x09;-&amp;#xff;]', '')"/>

    (1-1/1)

    Please register to reply