Subject: RE: [xsl] Problems with apersand (&) when trying to dynamically define a character value as an attribute value. From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 26 Oct 2006 16:00:18 +0100 |
> This looks like the neatest solution available to me but I am > having a bit of trouble getting it working. I have created > the throw away XSLT stylesheet with the following: > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > <xsl:template match="/"> > <xsl:for-each select="32 to 65535"> > <xsl:value-of select="codepoints-to-string(.)"/> > Error at xsl:value-of on line 5 of > file:/C:/saxon/generatecharstring.xsl: > FOCH0001: Invalid XML character [x d800] Transformation > failed: Run-time errors were reported > > Have I misunderstood what you meant? > No, it was just an oversight on my part that 32 to 65535 includes the characters in the surrogate range, which are not legal characters when used on their own. You'll have to handle this by something like <xsl:for-each select="32 to 65535"> <xsl:choose> <xsl:when test=.. in surrogate range .." <xsl:value-of select="codepoints-to-string(.)"/> </xsl:when> <xsl:otherwise>*</xsl:otherwise"> IIRC the surrogate range is d800 to dfff. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Problems with apersand (&, Robert Eaton | Thread | Re: [xsl] Problems with apersand (&, David Carlisle |
RE: [xsl] Problems with apersand (&, Robert Eaton | Date | Re: [xsl] Problems with apersand (&, David Carlisle |
Month |