[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problems with apersand (&) when trying to dynamica

Subject: RE: 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
RE:  Problems with apersand (&) when trying to dynamica
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.