|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Complicated Variable/Xpath question
Try
<xsl:key name="r" match="interlink" use="linksource/@href"/>
<xsl:template match="anchor">
<xref pointer="key('r', @id)/linktarget/@href"/>
</xsl:template>
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Andrew Borsz [mailto:andrew@xxxxxxxxxxxxxxx]
> Sent: 15 August 2005 19:05
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Complicated Variable/Xpath question
>
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








