By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,740 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,740 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.