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

AW: Quoting quote

Subject: AW: Quoting quote
From: "Lensch, Thomas" <Lensch@xxxxxxxx>
Date: Fri, 2 Sep 2005 11:31:23 +0200
misquoted literal... expected single quote
Hi,

this solution throws the exception:

rm.TransformerConfigurationException:
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The
element type "xsl:when" must be terminated by the matching end-tag "".

because the ' opens a string that isn't closed. And later the "when" which
contains the variable isn't closed ...

Regards,
Thomas

-----Urspr|ngliche Nachricht-----
Von: andrew welch [mailto:andrew.j.welch@xxxxxxxxx]
Gesendet: Freitag, 2. September 2005 11:23
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re:  Quoting quote

On 9/2/05, andrew welch <andrew.j.welch@xxxxxxxxx> wrote:
> On 9/2/05, Lensch, Thomas <Lensch@xxxxxxxx> wrote:
> > Hi,
> >
> > i want to escape a single quote '
> >
> > Text with such quotes is used in JavaScript Calls. How Can i do this?
> >
> > Alternatively i could throw them away (because it's not much loss of
> > information).
> >
> > But the following doesn't work:
> >
> >         <xsl:value-of select="translate($tHtml, '&#x27;', 'x')"/>
> >
> > It produces
> >
> > javax.xml.transform.TransformerConfigurationException:
> > javax.xml.transform.TransformerException:
> > javax.xml.transform.TransformerException: misquoted literal...
> > expected single quote!
> >
> > What's the problem here?
>
> The character reference gets resolved by the xml parser before the
> xslt processor gets to see it, so you have three single quotes '''
> which throws the error.
>
> The usual way round this is define a variable
>
> <xsl:variable name="apos" select="'"/>
>
> (that's a single quote between the double quotes in there)
>
> then use translate($tHtml, '$apos;', 'x')
>

Sorry still haven't woken up:

<xsl:variable name="apos">'<xsl:variable>

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.