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

Re: Getting ordering info from a lookup table

Subject: Re: Getting ordering info from a lookup table
From: Nic James Ferrier <nferrier@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 30 Oct 2006 23:53:14 +0000
file lookup table
"Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx> writes:

> My transform is using an external XML file as a lookup table. Among other
> things, the external file contains a list:
>   ...
>   <files>
>     <doc>file_one</doc>
>     <doc>file_two></doc>
>     <doc>file_three</doc>
>     ...
>   </files>
>
> Each time the transform runs, the input XML file corresponds to one of the
> <doc> elements in the lookup file. The input file name is passed in as a
> parameter to the transformation.
>
>   <xsl:param name="myself" />
>
> I think the following construction can do the lookup to the external file
> and locate the current doc:
>
>   .. select="document('lookup.xml')/files/doc[. = $myself]"
>
> but of course this is pointless by itself as I already have the doc name.
> What I actually want is to obtain the names of the previous and next docs -
> if they exist. There's surely an elegant way to do this, but I don't know
> it. What can I do?

How about:

   select="document('lookup.xml')/files/doc[. = $myself]"/preceding-sibling::."

and of course:

   select="document('lookup.xml')/files/doc[. = $myself]"/following-sibling::."


-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   for all your tapsell ferrier needs

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.