Quotes in XPath pattern
Posted on 2002-04-24
I use the XML data island on HTML page to hold data on categories and products assigned to them. In some places I have to add and remove products to categories. So, to find a product in a category node, I use this syntax:
set prd = nod.selectsinglenode("Products/Product[@name=""" & tag.innerText & """]")
wherre tag.innerText contain the product name. The problem is when a product name qontains double quotes ("). I could use this syntax:
set prd = nod.selectsinglenode("Products/Product[@name='" & tag.innerText & "']")
but in this case, an error rised when a product name contain single quotes. Is there some technique to solve this? Like for example in SQL, if a criteria contain a quote, I just replace the quote bu two quotes.