Guest Acidbird Posted December 7, 2007 Share Posted December 7, 2007 Hello,I'm working on a xsl that will convert an xml file into an xsl-fo for pdf generation (fop). Both file are UTF-8 encoded. My problem comes from special caracter (like ® for example). They are stored in a <text> element of my xml using a symbol-value attribute witch is set to the hexadecimal code of the unicode caracter like that : <text base-line="SUPER" symbol-family="BODY_TEXT" symbol-value="00AE"/> My problem is that i can't display those caracter properly. I try to "build" the exepression unicodeValue; but It's those string that is displayed in the result, not the special caracter (Eg , in my resulting file, I have something like &#x... )Here is the Xsl that handle the parsing of the sybol-value attribute <xsl:template match="@symbol-value"> <xsl:param name="contents"/> <xsl:variable name="rolo"> <xsl:value-of select="."/> </xsl:variable> <xsl:variable name="rolo2"> <xsl:value-of disable-output-escaping="yes" select="concat('&#x',$rolo, ';' )"/> </xsl:variable> <xsl:text>[<xsl:copy-of select="$rolo2"/>]</xsl:text> <!-- <![CDATA[]]>&#x<xsl:value-of select="."/>; --> </xsl:template> Does someone has an idea on what is going wrong ? Or just an idea of how I could handle this differently, I'm really stuck on this one For the moment, my only solution is to create a template for each existing symbol like that <xsl:template match="@symbol-value[.='00A2']"> ¢</xsl:template><xsl:template match="@symbol-value[.='20AC']"> €</xsl:template>... Witch would be a mess to maintain Link to comment Share on other sites More sharing options...
boen_robot Posted December 7, 2007 Share Posted December 7, 2007 Yeah, I've tried that one too. Never worked and I think I know why.The only real solution I ever came around was to actually write the literal character in the XML. Since it's UTF-8 encoded, it should be no problem to store it as is in the XML. Even if it was, you can always create an entity reference directly in the XML document.In other words, XSLT just doesn't allow you to "generate" character references. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.