Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript variable XSLT quotation mark prob

Status
Not open for further replies.

JontyMC

Programmer
Joined
Nov 26, 2001
Messages
1,276
Location
GB
I am parsing an XSLT transformation to put in a JavaScript variable, to enable me to pull a book from an XML file of books. The variable is taken from an HTML input box. Works fine except when the book contains a ' (quotation mark).

The JavaScript variable is "bookfind". A typical example would be var bookfind = "title='Devil's Claw'". How do I get the ' into XSLT?

Could I do something like Devil{& amp;}s Claw in JavaScript? Or do I have to mess with it in XSLT?

Thanks,

Jon
 
I think the problem might be in the scripting.
Your variable is string: title='Devil's Claw'
If you take that apart later, you'll probably want to extract another variable (title) that is a string.
However, you'll run into problems there, as the string is openened with singlequote it is close right behind Devil.
Can't you just use to variables?
var field = "title";
var value ="Devil's claw" ?
 
Could I do something like Devil{& amp;}s Claw in JavaScript?

Did you try {& apos;} ?
 
Thanks for the replies, I solved the problem using escaped "'s eg:

var bookfind = "title=\"Devil's Claw\"".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top