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

Re: How to create a literal string attribute value tha

Subject: Re: How to create a literal string attribute value that contains an apostrophe?
From: Marc <Marc.Liste@xxxxxxx>
Date: Mon, 09 Dec 2013 16:07:02 +0100
Re:  How to create a literal string attribute value tha
In this case I do something like :
<xsl:value-of>he's good</xsl:value-of>
that can be do with the <xsl:variable ou <xsl:attribute, if you want you can push it in a <xsl:text>


Marc

Le 09/12/2013 15:57, Costello, Roger L. a icrit :
Hi Folks,

I want to output a string.

This

<xsl:value-of select="'he is good'" />

outputs:

he is good

Now, suppose that I want to output:

he's good

This

<xsl:value-of select="'he&apos;s good'" />

produces an error. Apparently the entity is resolved to yield

<xsl:value-of select="'he's good'" />

and that is obviously an error.

So what's the solution?

Answer: escape the ampersand in the apostrophe entity reference:

<xsl:value-of select="'he&amp;apos;s good'" />

Now that doesn't seem reasonable. It means that there is double entity resolution occurring: the first to convert

&amp;apos;

to
	
	&apos;

and the second to convert

&apos;

to

'

Where is this double entity resolution occurring? The XML parser does the first entity resolution. What is doing the second entity resolution?

/Roger

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.