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

Re: xsl:key question

Subject: Re: xsl:key question
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 10 Jul 2001 06:42:16 -0700 (PDT)
drugcompany
Kerin Cosford wrote:

> <Drug>
> 	<DrugCitation>
> 		<DrugCompanyList>
> 			<DrugCompany>
> 				<Company CDLID="18767">
> 					<CompanyCitation>
> 						<CompanyName>
> 							Johnson and Johnson
> 						</CompanyName>
> 					</CompanyCitation>
> 				</Company>
> 			</DrugCompany>
> 		</DrugCompanyList>
> 	</DrugCitation>
> 	<DrugDevelopmentList>
> 		<DrugDevelopment>
> 			<CompanyRef CDLID="18767"/>
> 		<DrugDevelopment>
> 	</DrugDevelopmentList>
> </Drug>
> 
> I need to have an xsl:key which will return the text within <CompanyName>
> when a CLID="" value of the <Company> element is passed to it (The value of
> the CDLID attribute is taken from the <CompanyRef> element).
> 
> How do I do this? All of the xsl:key examples I've come across only concern
> retrieving values from the same element that is queried. I'm sure this is a
> simple XPath expression, but, as I say, I just can't seem to work it out
> today.

Hi Kerin,

Use:
    <xsl:key name="kName" match="CompanyName" use="../../@CDLID"/>

or, if you really need just the text() children of "CompanyName":

    <xsl:key name="kNameText" match="CompanyName/text()" use="../../../@CDLID"/>

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

 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.