[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Complicated Variable/Xpath question

Subject: RE: Complicated Variable/Xpath question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 15 Aug 2005 19:08:20 +0100
xref pointer
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.