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

Subject: RE: [xsl] Using position predicate in XPath string within selectS ingleNode DOM method
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Thu, 25 Nov 2004 09:13:49 -0600
Thanx for the pointer, Matthieu :-)

I'm sure the subject will be opened somewhere near in the future - it keeps
coming up those nasty issues we have when using Microsoft products... life
isn't everything.

Cheers,
<prs/>

-----Original Message-----
From: Matthieu Ricaud [mailto:matthieu.ricaud@xxxxxxx]
Sent: Thursday, November 25, 2004 8:23 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Using position predicate in XPath string within
selectSingleNode DOM method

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