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

RE: XSLT/XPath help to resolve definition references i

Subject: RE: XSLT/XPath help to resolve definition references in a W SDL XML fi le
From: thomas.cherel@xxxxxxxxxxxxxxxxxxxxx
Date: Wed, 4 Sep 2002 14:47:36 -0400
xslt resolve references
It almost worked, but it put me on the right track.
What you gave me is not working as in your select, in the key function
second argument, the @aRef is not known in this context (this is not an
attribute of the A element. But I was able to achieve what I wanted doing
the following:

<xsl:key name="Crefs" match="C" use="substring-after(@aRef,':')"/>

 select="A[count(key('Crefs',@name))>0]/B"

The condition in the select of the A element means any A referenced by at
least one C element.

Thanks a lot for the help.

Thomas

-----Original Message-----
From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx
[mailto:TSchutzerWeissmann@xxxxxxxxxxxxxxxx] 
Sent: Wednesday, September 04, 2002 10:41 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  XSLT/XPath help to resolve definition references in a W
SDL XML fi le


hi Thomas,

> I need some help on pure XSLT/XPath syntax/capabilities. Let's say 
> that I have an XML document looking like that:
> 
> <root>
>   <A name="a1"><B .../></A>
>   <A name="a2"><B .../></A>
>   <A name="a3"><B .../></A>
>   <C aRef="ns1:a1"/>
>   <C aRef="ns2:a2"/>
> </root>
> 
> I want to be able to select all the B element which are under
> the A elements
> referenced by the C element (the A elements for which a 
> C/@aRef attribute
> value, minus the prefix, is equal to the A/@name attribute).
> 

Use a key on the C's:

<xsl:key name="CRefs" match="C" use="@aRef"/>

Then this as your path in <root> context.
 select="A[@name = key('CRefs',substring-after(@aRef,':'))]/B"

Don't know if it works...

Tom
---
"At the first performance I led the attack in person 33 times.
We had three acclamations, four hilarities, two thrilling movements,
four renewals of applause and two indefinite explosions."





 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.