Help in XQuery!!

:frowning: Trying to figure out how to convert this query to XQuery format…

Product/SKU[@id~='']

Anyone can help? Basically I want to get products that have sku id like "125
" and do a sort in the return result.

Can someone who is already expert in XQuery give me some lights?

Please get the attached schema.

Thanks.
Catalog.tsd (2.9 KB)

I think you want

Product/SKU[contains(@id, ‘*’)]

Michael Kay

Sorry. I got mix up the two words. (XQuery and X-Query).

What I want is in XQuery my query string is Product/SKU[@id~=‘*’], so if I want to convert to X-Query string, what will it be.

Thanks.

Hi,

I managed to resolve my puzzle. Thanks.

But I got another problem. when I execute the following query in TXQuery API, I encounter Exception.

path = “declare namespace ft="http://www.w3.org/2002/04/xquery-operators-text\”"+ " " +
“for $product in input()/Product” + " " +
“where (ft:text-contains($product/SKU/description,"” + input + “"))” + " " +
“return count($product)”;

TXQuery query = TXQuery.newInstance(path);
TResponse responseB = accessorB.xquery(query);

Is my XQuery string correct?


Cheers,
Hwee Choo