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

Re: Bug with character map?

Subject: Re: Bug with character map?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 26 Jul 2012 23:01:32 +0100
Re:  Bug with character map?
First, section 25.1 of the XSLT 2.0 specification states:

Character mapping is not applied to characters for which output escaping
has been disabled

Secondly, URI escaping.

With your first link, the serializer knows it is generating a URI-valued
attribute, so it applies %HH escaping as required by the spec.

With your second link, generated using disable-output-escaping, the
serializer doesn't know it's a URI-valued attribute, so the %HH escaping
doesn't happen.

It seems you don't want the %HH escaping to happen (you don't say why).
If that's the case, you can prevent it using the escape-uri-attributes
attribute on xsl:output.

Michael Kay
Saxonica


On 26/07/2012 17:29, Frederic Bergeron wrote:
> Hi,
>
> I'm using a character map in my stylesheet to convert some special characters.
>
> Here is my code:
>
> <xsl:stylesheet version="2.0"
>     xmlns="http://www.w3.org/1999/xhtml"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     exclude-result-prefixes="xsi xsl">
>
>     <xsl:character-map name="funny-quote">
>       <xsl:output-character character="&#146;" string="’"/>
>     </xsl:character-map>
>
>     <xsl:output method="xhtml" indent="yes" use-character-maps="funny-quote"/>
>
>     <xsl:variable name="link"
> +select="'http://www.infiressources.ca/fer/depotdocuments/Modeles_et_demarches_d&#146;education_therapeutique-place_des_TIC.pdf'"/>
>
>     <xsl:template match="/">
>         <html>
>             &#160;
>             <a>
>                 <xsl:attribute name="href"><xsl:value-of select="$link"/></xsl:attribute>
>                 <xsl:value-of select="$link"/>
>             </a>
>             <br/>&#160;
>             <xsl:text disable-output-escaping="yes">&lt;a href=&quot;</xsl:text><xsl:value-of select="$link"/><xsl:text
> +disable-output-escaping="yes">"&gt;</xsl:text><xsl:value-of select="$link"/><xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
>         </html>
>     </xsl:template>
> </xsl:stylesheet>
>
> I generate 2 hyperlinks.  I was expecting the 2 links to be exactly the same.  However, the first link's href value is wrong.  Is this a bug or am I missing
> +something?
>
> I'm using Saxon HE 9.3.0.5.
>
> Frederic Bergeron

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.