I am trying to search for an element and return the full xpath to that element in XSLT.
For example, I have an XSLT file like this:
<title>
<header>
<info1>A</info1>
<info2>B</info2>
</header>
</title>
I'm looking for a function where I can parse the XSLT file, enter something like:
info1
and return:
title/header/info1
If there is more than one element with that tag, then I want to return all of them.
I've tried the methods suggested here and here but they don't seem to work. Any help would be appreciated, thanks!
@). Try without the@.//*[text()="A"]. After that you have to rebuild the path from this node until the root (but in reverse) by getting the parent of each node until you reach the root.