path to node as a string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shaun

    path to node as a string

    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
  • System Administrator

    #2
    Re: path to node as a string

    In article <shaun.roe-1A0BA5.17271517 052005@sunnews. cern.ch>,
    shaun <shaun.roe@cern .ch> wrote:
    [color=blue]
    >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.[/color]

    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

    Comment

    Working...