path to node as a string

S

shaun

Is it possible in XSLT to get the path to the current node as a string,
maybe change one element and then navigate to the new resulting string?

e.g.
I have two documents I want to merge. The root element has a different
name in each ("structure" and "values") but otherwise the trees -up to
the final leaf nodes- are the same.
I want to visit the nodes in "structure" and use the path to visit the
same nodes in "values", then insert the leaf nodes of values into
structure.

cheers

shaun
 
S

System Administrator

shaun said:
I want to visit the nodes in "structure" and use the path to visit the
same nodes in "values", then insert the leaf nodes of values into
structure.

Rather than constructing a complete xpath, I suggest that in each
template you maintain a variable pointing to the corresponding node in
the other document, which you pass as a parameter to the template.
Then use the position() of the current node to get the corresponding
child in the other document.

-- Richard
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top