xpath to determine program flow -- how to get there from here?

K

KathyB

Hi, sorry if this is the wrong group...but I don't see an xpath group
and hoping someone here can help me.

How do you assign variable to different elements within a single node
set?

I have a simple xml structure that I'm using to determine a workflow
process. I've read all the xpath documentation, but can't quite get my
brain around the precise methods I need. When a user enters a serial
number (sn), I need to find the last board with that serial number
that ALSO has a finish attribute (this one I can do). Then I need to
get the NEXT <instruction> element that does NOT have a <board>
element for that serial number attribute, so I know which @doc (xml
file) to serve up to the user. I hope this is clear enough.

<Workflow>
<Station name="Station1">
<Instruction order="1" doc="test1.xml">
<Boards>
<Board sn="12345" start="07/15/03" finish="07/15/03"/>
<Board sn="12346" start="07/15/03" finish="07/16/03"/>
</Boards>
</Instruction>
</Station>

<Station name=Station2">
<Instruction order="1" doc="test2.xml">
<Boards>
<Board sn="12345" start="07/15/03" finish="07/15/03"/>
<Board sn="12346" start="07/15/03"/>
</Boards>
</Instruction>
<Instruction order="2" doc="test3.xml">
<Boards>
<Board sn="12345" start="07/15/03" finish="07/15/03"/>
</Boards>
</Instruction>
</Station>
....etc.

So if the user enters sn="12346" I need to determine that they never
finished Station2, Instruction order="1" and serve up doc="test2.xml".

I can figure out most of the xpath stuff, but not sure how to assign
variables to the results. For example:

xNode1 = Select(//Board[@sn="12346" and @finish != "")
I need to set variables for that node's Station and Instruction
elements.
strStation = the <station> for that <board> element.
strInstruction = the <instruction> for that <board> element.

Then need to find the next Station and/or Instruction for that <board
@sn>???

Any pointers would be great!

Thanks, Kathy
 

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
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top