[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] Using position predicate in XPath string within selectSingleNode DOM method
From: "Matthieu Ricaud" <matthieu.ricaud@xxxxxxx>
Date: Thu, 25 Nov 2004 15:22:50 +0100

Last post on this subject which may not interrest everybody on the list
since it's not a pure xsl problem but more DOM and manipulation of XML
files.

So I've learnt the reason why Xpath expression is not always understood
within selectSingleNode DOM Method.
Just because, despite the msdn spec I found
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm
l/xmmthselectsinglenode.asp) describing this method, the language supported
is not Xpath by default, but rather a strange "XSLPattern" (the default
language obviously depends on the parser progID).

To be sure Xpath querys are understood, we must specifie it :

ObjXML.setProperty "SelectionLanguage", "XPath"

That's all

subject closed !

Matthieu.


-----Message d'origine-----
De : Matthieu Ricaud [mailto:matthieu.ricaud@xxxxxxx]
Envoyi : jeudi 25 novembre 2004 10:54
@ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : RE: [xsl] Using position predicate in XPath string within
selectSingleNode DOM method


Hi Pieter,

Thanks a lot for your proposition of finding a solution together to my
problem.

At the moment I was going to tell you what ITEM[1] return, I noticed it
returns the SECOND <ITEM> node and not the FIRST !

And actually this is the solution of my problem !

With SelectSingleNode Method the Xpath position indice starts at 0 and not 1
like in XSL's Xpath query.

That means for example  :

SelectSingleNode("/FORMATION[0]/EPREUVES[0]/EPREUVEAOPT[1]/OPTION[0]")

select the same node as :

<xsl:for-each select="/FORMATION[1]/EPREUVES[1]/EPREUVEAOPT[2]/OPTION[1]">

Everything's ok now ! exept that I'm really angry with Microsoft which did
not specify this in the msdn !

But anyway, that's great !!

thanks all for helping !

Matt


Current Thread
Keywords