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

Re: How to include ' in the argument of <translate> f

Subject: Re: How to include ' in the argument of <translate> function
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 Nov 2009 16:51:58 -0500
Re:  How to include ' in the argument of <translate>  f
At 2009-11-20 16:46 -0500, Mak, Lucas Wing Kau wrote:
I am trying to replace the apostrophe (') with a space by the <translate> function but oXygen gave me an error message ("unmatched quote in expression") when I put &apos; in the second argument. How can I resolve that?

You aren't showing your current code for volunteers to analyze where you are going wrong.


You have to distinguish attribute delimiters from string delimiters.

For example, this should work just fine:

select='translate($old,"&apos;","")'

... because I'm using single quotes as my attribute delimiter and double quotes for my string delimiters. That choice of string delimiter allows me to embed an apostrophe in the string, which I do with the entity reference.

Remember that entity substitution happens long before the syntax analysis of the function call, so if you had:

select="translate($old,'&apos;','')"

... then you would get an error because that is *no* different from:

select="translate($old,''','')"

I hope this helps.

. . . . . . . . . Ken


-- Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

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.