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

Re: Escaping single-quotes - an old chestnut I suspect

Subject: Re: Escaping single-quotes - an old chestnut I suspect but won't respond to any amount of Googling...
From: "Gav..." <brightoncomputers@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2007 12:27:45 +0800 (WST)
Re:  Escaping single-quotes - an old chestnut I suspect
<quote who="Matt Poff">
> Hi,
>
> I have an XSLT file which is generating a number of SQL statements from
> an XHTML file (output method is set to "text"). I need to escape
> apostrophe and quote characters in text nodes and have tried using the
> code below:
>
>     <xsl:function name="hf:escapechars" >
>         <xsl:param name="currnode" />
>         <xsl:variable name="apos" select='"&apos;"' />
>         <xsl:variable name="quot" select="'&quot;'" />
>         <xsl:variable name="backslash">\</xsl:variable>
>
>         <xsl:value-of
> select="replace($currnode,'$apos','concat($backslash,$apos))"/>
>     </xsl:function>
>
> This generates "Description: E Invalid replacement string in replace():
> \ character must be followed by \ or $". How can i successfully escape
> the backslash so it will output?

Have you tried the error suggestion such as :-

<xsl:variable name="backslash">\\</xsl:variable>

Gav...

>
> Thanks for you help,
> Matt
>


-- 
Gav...

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.