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

RE: Reverse lookup table

Subject: RE: Reverse lookup table
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 10 Jul 2002 09:07:19 +0100
reverse lookup
The standard technique is to declare a global variable

<xsl:variable name="root" select="/"/>

that allows you to refer to the principal source document at any time.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Dunning, John
> Sent: 09 July 2002 20:31
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Reverse lookup table
> 
> 
> Hi all,
> 
> I'm posting this as a follow-up to a post I made a couple 
> weeks ago (changing scope in for-each) which I guess could 
> have been phrased more clearly.  What I'm trying to 
> accomplish is a 'reverse' lookup table; that is, if something 
> is *not* in the document, have the stylesheet supply the 
> boilerplate text.  If the answer is indeed a FAQ, please 
> forgive my thickness and please help clarify.
> 
> The problem in all my attempted solutions is that once I 
> start looping through the lookup table my scope shifts from 
> the XML document to the stylesheet.  The logic I'm using is:
> + get the organization from the XML doc (AP)
> + find that organization in the lookup table
> + loop through the countries that make up that organization in the 
> + lookup
> table comparing them to the XML document (this step is where 
> the problem lies).
> 
> Again, any and all help is appreciated.  Thanks, John
> 
> <!-- INPUT XML -->
>    <regional>
>     <region>
>      <country>AP</country>
>     </region>
>    <!-- note country 'GH' missing; note also that countries 
> that make up a region
>         are not contained, but follow -->
>     <country>GM</country>
>     <country>KE</country>
>     <country>LS</country>
>     <country>MW</country>
>     <country>MZ</country>
>     <country>SD</country>
>     <country>SL</country>
>     <country>SZ</country>
>     <country>TZ</country>
>     <country>UG</country>
>     <country>ZM</country>
>     <country>ZW</country>
>    </regional>
> 
> <!-- lookup table -->
> <LU:orglist>
> 	<LU:organization name="AP">
> 		<LU:state name="GH"/>
> 		<LU:state name="GM"/>
> 		<LU:state name="KE"/>
> 		<LU:state name="LS"/>
> 		<LU:state name="MW"/>
> 		<LU:state name="MZ"/>
> 		<LU:state name="SD"/>
> 		<LU:state name="SL"/>
> 		<LU:state name="SZ"/>
> 		<LU:state name="TZ"/>
> 		<LU:state name="UG"/>
> 		<LU:state name="ZM"/>
> 		<LU:state name="ZW"/>
> 	</LU:organization>
> </LU:orglist>
> 
> <!-- desired output -->
> Organization: AP: GM KE LS MW MZ SD SL SZ TZ UG ZM ZW (except GH)
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.