xsl-list
[Top] [All Lists]

RE: Using position predicate in XPath string within selectSingleNode DOM method

2004-11-24 04:00:19
Hi Pieter,

Thanks for your answering !
Unfortunately foo[.=3] doesn't work either.

I was using MSXML2.FreeThreadedDOMDocument as progId so I changed it to
"MSXML2.DOMDocument.3.0", but the result is the same
(I've also install the SP4 for MSXML 3.0)

Curisously I get it work when writing ITEM[1] (but not for ITEM[.=1])
When writing ITEM[2] or ITEM[.=2] it doesn't work anymore !

This is my asp page :

<%@ Language=VBScript %>
<%Response.Buffer=true%>
<%Response.contentType = "text/html"%>
<%Response.charset = "ISO-8859-1"%>
<%
Dim objXML
        set objXML= Server.CreateObject("MSXML2.DOMDocument.3.0")
        objXML.async = false
        objXML.load server.MapPath("test.xml")

Dim objNode
        Set objNode=objXML.documentElement.SelectSingleNode("ITEM[.=2]")

Response.write objNode.getAttribute("libelle")
%>

And the xml doc :
<?xml version="1.0"?>
<ROOT>
        <ITEM libelle="menu1" />
        <ITEM libelle="menu2" />
</ROOT>

My goal is to manipulate a specific node choosen by the user who just click
an HTML link for this node, the xsl I use to display all the node with link
get the full node Path which is send to the asp page...

Would it work using another XML parser ?
Any other solution ?

Matthieu.


-----Message d'origine-----
De : Pieter Reint Siegers Kort 
[mailto:pieter(_dot_)siegers(_at_)elnorte(_dot_)com]
Envoyé : mercredi 24 novembre 2004 01:51
À : xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Objet : RE: [xsl] Using position predicate in XPath string within
selectSingleNode DOM method


Hi Matthieu,

Try

Set objNode= objXML.selectSingleNode("foo[.=3]")

Obviously, using MSXML 3.0, objXML should be of type MSXML2.DOMDocument.3.0,
and objNode should be of type MSXML2.IXMLDOMNode.

HTH,
<prs/>

-----Original Message-----
From: Matthieu Ricaud [mailto:matthieu(_dot_)ricaud(_at_)cned(_dot_)fr]
Sent: Tuesday, November 23, 2004 10:20 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com; Hardy Merrill
Subject: [xsl] Using position predicate in XPath string within
selectSingleNode DOM method

Hi !

Does anybody know why I can't write something like this :

Set objNode= objXML.selectSingleNode("foo[3]")

(no node matched)

Whereas objNode= objXML.selectSingleNode("foo") works fine

foo[3] is the abreviation for foo[position()=3]

position() is a function, would that means that function are not allowed in
Xpath string within selectSingleNode

I've also tried with SelectNodes method, but I still have the same problem

I use ASP with DOM and my parser is MSXML3

Has anybody an explanation for this,

In advance Thanks,

Regards,

Matthieu.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--