Select next sibling XPath?

Philipp Lenssen

Usenet Archive
Joined
Aug 14, 2000
Messages
285
Reaction score
0
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>
 

Dimitre Novatchev

Usenet Archive
Joined
Nov 7, 2000
Messages
737
Reaction score
0
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

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top