Select next sibling XPath?

P

Philipp Lenssen

I have some chapters a document goes through, so at the end of each
document I want to output "Continue with XYZ", where XYZ is the
next-sibling of the current one I select. However I don't know how to
write the XPath to express this. I tried variants of this with
ASP/MSXML:

sPhase = "foo"
set xNext = xPhasesDoc.documentElement.selectSingleNode(
"following-sibling::phase[@type = '" & sPhase & "']")

Where the XML is like

----------
<?xml ...?>
<content>
<phase type="foo">Foo</phase>
<phase type="bar">Bar</phase>
</content>
 
D

Dimitre Novatchev

Philipp Lenssen said:
I have some chapters a document goes through, so at the end of each
document I want to output "Continue with XYZ", where XYZ is the
next-sibling of the current one I select. However I don't know how to
write the XPath to express this. I tried variants of this with
ASP/MSXML:

sPhase = "foo"
set xNext = xPhasesDoc.documentElement.selectSingleNode(
"following-sibling::phase[@type = '" & sPhase & "']")

Where the XML is like

----------
<?xml ...?>
<content>
<phase type="foo">Foo</phase>
<phase type="bar">Bar</phase>
</content>


Use:

set xNext =
currentPhaseNode.selectSingleNode("following-sibling::phase[@type = '"

& currentPhaseNode.getAttribute("type")

& "' ][1]")

where currentPhaseNode is the current "phase" node.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top