[xsl] Complicated Variable/Xpath question

Subject: [xsl] Complicated Variable/Xpath question
From: Andrew Borsz <andrew@xxxxxxxxxxxxxxx>
Date: Mon, 15 Aug 2005 14:05:10 -0400
Hello List,
I'm having trouble getting value I want into my result. I feel one or more variables and Xpath expressions will do the trick but I can't seem to get it quite right. I'm using XSLT 1.0 and Libxslt.


I have interlink elements like this:

<interlink linktype="seeAlso">
<linksource href="example-1"></linksource>
<linktarget href="what-I-need"></linktarget>
</interlink>

These interlink groups occur all throughout the document, in various locations. They could be anywhere, and the href's almost all have different values. Then I have these anchors throughout my document too:

<anchor id="example-1">
</anchor>

Again, these anchor href's are almost always different as well. When I process anchor, I need to create an element 'xref' with an attribute 'pointer' whose value is the value of the 'href' attribute of the 'linktarget' element which is the following-sibling of the 'linksource' element whose 'href' attribute has the same value as the 'href' attribute of my current 'anchor'. So for in this particular example, I'd like to turn this:

<anchor id="example-1">
</anchor>

Into this:
<xref pointer="what-I-need">
</xref>

Everything I've tried gives me <xref pointer=""></xref>. Any help would be greatly appreciated.


-Andrew


Current Thread