I am getting mixed results when trying to select specific nodes...
Using this XML as a reference:
If you don't change the "SelectionLanguage" to "XPath"...
Dom.setProperty "SelectionLanguage", "XPath"
//Parent[0] selects the Parent, rather than the normal //Parent[1]
So... Using XPath as the selection language...
Dom.selectNodes("//Child") Selects all 6 Child Nodes:
If you use one of these:
Dom.selectSingleNode("//Child[1]")
Dom.selectSingleNode("//Child[2]")
It will work fine...
But if you use:
Dom.selectSingleNode("//Child[3]")
Dom.selectSingleNode("//Child[4]")
Dom.selectSingleNode("//Child[5]")
Dom.selectSingleNode("//Child[6]")
It will not select anything...
Though, if you use:
Dom.selectSingleNode("//Parent[2]/Child[1]")
Dom.selectSingleNode("//Parent[2]/Child[2]")
Dom.selectSingleNode("//Parent[3]/Child[1]")
Dom.selectSingleNode("//Parent[3]/Child[2]")
It will select these nodes...
Why does selectNodes("//Child") select all of the Children, but selectSingleNode("//Child[x]") does not...
I could have sworn that these selection methods (Such As //Child[6]) worked in XSL templates before...
Should I be using a different Selection Language for Dom?
Or was I just imagining things...?
Visit My Site
PROGRAMMER: Red-eyed, mumbling mammal capable of conversing with inanimate objects.
Using this XML as a reference:
Code:
<DocumentRoot>
<Parent>
<Child>1</Child>
<Child>2</Child>
</Parent>
<Parent>
<Child>3</Child>
<Child>4</Child>
</Parent>
<Parent>
<Child>5</Child>
<Child>6</Child>
</Parent>
</DocumentRoot>
If you don't change the "SelectionLanguage" to "XPath"...
Dom.setProperty "SelectionLanguage", "XPath"
//Parent[0] selects the Parent, rather than the normal //Parent[1]
So... Using XPath as the selection language...
Dom.selectNodes("//Child") Selects all 6 Child Nodes:
Code:
<Child>1</Child>
<Child>2</Child>
<Child>3</Child>
<Child>4</Child>
<Child>5</Child>
<Child>6</Child>
If you use one of these:
Dom.selectSingleNode("//Child[1]")
Dom.selectSingleNode("//Child[2]")
It will work fine...
But if you use:
Dom.selectSingleNode("//Child[3]")
Dom.selectSingleNode("//Child[4]")
Dom.selectSingleNode("//Child[5]")
Dom.selectSingleNode("//Child[6]")
It will not select anything...
Though, if you use:
Dom.selectSingleNode("//Parent[2]/Child[1]")
Dom.selectSingleNode("//Parent[2]/Child[2]")
Dom.selectSingleNode("//Parent[3]/Child[1]")
Dom.selectSingleNode("//Parent[3]/Child[2]")
It will select these nodes...
Why does selectNodes("//Child") select all of the Children, but selectSingleNode("//Child[x]") does not...
I could have sworn that these selection methods (Such As //Child[6]) worked in XSL templates before...
Should I be using a different Selection Language for Dom?
Or was I just imagining things...?
Visit My Site
PROGRAMMER: Red-eyed, mumbling mammal capable of conversing with inanimate objects.