Click to See Complete Forum and Search --> : XSL Pattern Match HELP!!!


Ian
04-22-2002, 08:07 AM
Hi,

I'm using ASP to find a certain NODE within some XML. The XSL pattern needs
to be formed so that I can find a PROD node/element whose attribute1 = "x"
AND whose attribute2 = "y".

At the moment i can only get it to work for attribute1:
<%
sPatternString = "CART/PROD[@attribute1 = x]
oNode = xmlDoc.selectSingleNode(sPatternString)
%>

How can I structure my XSL so that it brings back a PROD node where attribute1
= "x" AND attribute2 = "y"?


Thanks.

Russell Jones
04-23-2002, 03:52 AM
Add the word "and" between the two tests. Also, you need single quotes
around the test values--they're strings.

Here's an (untested) example.

<%
sPatternString = "CART/PROD[((@attribute1 = 'x') and (@attribute2='y'))]"
oNode = xmlDoc.selectSingleNode(sPatternString)
%>

"Ian" <ianfoster11@hotmail.com> wrote in message
news:3cc3ef07$1@10.1.10.29...
>
> Hi,
>
> I'm using ASP to find a certain NODE within some XML. The XSL pattern
needs
> to be formed so that I can find a PROD node/element whose attribute1 = "x"
> AND whose attribute2 = "y".
>
> At the moment i can only get it to work for attribute1:
> <%
> sPatternString = "CART/PROD[@attribute1 = x]
> oNode = xmlDoc.selectSingleNode(sPatternString)
> %>
>
> How can I structure my XSL so that it brings back a PROD node where
attribute1
> = "x" AND attribute2 = "y"?
>
>
> Thanks.
>

Ian
04-23-2002, 06:32 AM
Thanks a million Russell! It works!!!!

Thanks again!


"Russell Jones" <arj1@northstate.net> wrote:
>Add the word "and" between the two tests. Also, you need single quotes
>around the test values--they're strings.
>
>Here's an (untested) example.
>
><%
>sPatternString = "CART/PROD[((@attribute1 = 'x') and (@attribute2='y'))]"
>oNode = xmlDoc.selectSingleNode(sPatternString)
>%>
>
>"Ian" <ianfoster11@hotmail.com> wrote in message
>news:3cc3ef07$1@10.1.10.29...
>>
>> Hi,
>>
>> I'm using ASP to find a certain NODE within some XML. The XSL pattern
>needs
>> to be formed so that I can find a PROD node/element whose attribute1 =
"x"
>> AND whose attribute2 = "y".
>>
>> At the moment i can only get it to work for attribute1:
>> <%
>> sPatternString = "CART/PROD[@attribute1 = x]
>> oNode = xmlDoc.selectSingleNode(sPatternString)
>> %>
>>
>> How can I structure my XSL so that it brings back a PROD node where
>attribute1
>> = "x" AND attribute2 = "y"?
>>
>>
>> Thanks.
>>
>
>