p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: XPath Expression Question


Message #1 by Kerin Cosford <Kerin.Cosford@c...> on Mon, 9 Jul 2001 15:29:22 +0100
> I need to have a n XPath expression for an <xsl:value-of> 
> element whihc
> selects the following (in English):
> 
> any 'CompanyName' elements, which have a grandparent with a 'CDLID'
> attribute equal to the 'CDLID' attribute of the element 
> 'Company' within the
> current node.

//CompanyName[../../@CLDID = current()/Company/@CLDID]

But it would be more efficient to use keys.

Mike Kay
Software AG
> 
> Does that make sense?
> 
> Here's a snippet of the XML in question:
> 
> <DrugCompanyList>
> 	<DrugCompany>
> 		<Company CDLID="12337">
> 			<CompanyCitation>
> 				<CompanyName>
> 					**Johnson and Johnson
> 				</CompanyName>
> 			</CompanyCitation>
> 		</Company>
> 	</DrugCompany>
> </DrugCompanyList>
> 
> <DrugDevelopmentList>
> 	*<DrugDevelopment>
> 		<CompanyRef CDLID="12337"/>
> 	</DrugDevelopment>
> </DrugDevelopmentList>
> 
> 
> So, when the context Node is <DrugDevelopment> (marked with 
> *), I need to
> ouput the value of the <CompanyName> (**) element who's 
> grandparen <Company>
> element has a matching CDLID attribute.
> 
> 

  Return to Index