0
votes

I'm using classic ASP, XML and xPath to select some data and I'm trying to make a selection on the following xml where the node id_attribut contains "xc". So I would like to only select the first 2 attribut.

my xpath is :

"//attribut[contains(id_attribut,"xc")]"

but ASP is giving me the error:

msxml3.dll error '80004005' Unknown method. //attribut[-->contains(id_attribut<--,"xc")] /products/list_products.asp, line 54

Is contains() not a valid function for xPath in classic ASP (not ASP.net)?

I have the following XML:

<attributes>    
<attribut>
     <id_attribut>xc_elite</id_attribut>
     <level>4</level>
     <pty>1</pty>
     <parent>xc</parent>
   </attribut>
<attribut>
     <id_attribut>xc_performance</id_attribut>
     <level>4</level>
     <pty>2</pty>
     <parent>xc</parent>
</attribut>
<attribut>
     <id_attribut>alp_elite</id_attribut>
     <level>4</level>
     <pty>1</pty>
     <parent>alp</parent>
</attribut>
</attributes>

Thanks for any help!!

1
What happens when you try: //attribut[starts-with(id_attribut,"xc")] - Derek Hunziker
That's not an ASP error - looks like an XML error. - Dee
An actual line of VBScript code would improve this question. - AnthonyWJones

1 Answers

0
votes

MSXML3 isn't known for the quality of its error messages - try compiling it with a different processor to get better diagnostics.

I suspect the problem is your use of unescaped quotes around the second argument. If you use double quotes as the attribute delimiter, you must use single quotes around string literals in the XPath expression.