|
Subject: RE: [xsl] Complicated Variable/Xpath question From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 15 Aug 2005 19:08:20 +0100 |
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: [xsl] 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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Complicated Variable/Xpath qu, Andrew Borsz | Thread | [xsl] Complicated Variable/Xpath up, Andrew Borsz |
| [xsl] Complicated Variable/Xpath qu, Andrew Borsz | Date | Re: [xsl] How recursively iterate o, Wendell Piez |
| Month |