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

Re: single quotes..problem.

Subject: Re: single quotes..problem.
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 4 Jan 2001 13:20:52 +0000
quotes by tennison
Hi Sachi,

>     I am trying to send a string of like this "B's Beverages" to filter
> condition in XSL from javascript.
>    eg.
>      someobject.selectNodes("root/element["+selval+"]");
>     selval - is the string which I pass as  "@ShipName=B's Beverages".But it
> is not possible. any idea to slove this probelm.

The string that you pass as an argument into .selectNodes needs to be
a valid XPath. The string "B's Beverages" needs to be surrounded by
quotes so that the XPath processor recognises it as a string. Because
of the apostrophe in B's Beverages, the valid XPath that you need to
use is:

  root/element[@ShipName = "B's Beverages"]

So, selval needs to be set to the string:

  @ShipName = "B's Beverages"

Within the Javascript, you need to wrap that string in quotes so that
the Javascript processor can recognise it as a string. Within
Javascript, you have to escape single and double quotes within a
string using '\' so that they're not recognised as quotes. So, when
you set selval, use:

  selval = '@ShipName = \"B\'s Beverages\"';

or:

  selval = "@ShipName = \"B\'s Beverages\"";

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.