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

RE: How to find all parents having the same child?

Subject: RE: How to find all parents having the same child?
From: Bita Jooooooon <bjooooooon@xxxxxxxxx>
Date: Wed, 18 Jun 2003 14:34:12 -0700 (PDT)
bita
Jarno,

that was exactly what I much needed. 

Thanks a lot.
bjoon

 
--- Jarno.Elovirta@xxxxxxxxx wrote:
> Hi,
> 
> > Here an example:
> > 
> > <Quries>
> >  <Query name="query1">
> >    <Query name="query2">
> >      <Table name="table1"/>
> >      <Table name="table2"/>
> >      <Query name="query3">
> >        <Table name="table3"/>
> >      </Query>
> >    </Query> 
> >  </Query>
> >  <Query name="query4">
> >    <Table name="table1"/>
> >    <Table name="table2"/>
> >    <Table name="table3"/>
> >  </Query> 
> > </Queries>
> > 
> > Given that, I would like to extract all parents
> for
> > each leaf like the following:
> > 
> > table3: query4, query3
> > table1: query4, query1
> 
> did you mean
> 
>   table1: query4, query2
> 
> as query1 is not a direct parent of table1.
> 
> > query3: query2
> > query2: query1
> > 
> > An example from you on how to get that
> cross-reference
> > list would help me a lot.
> 
> Hopefully this will get you started.
> 
>   <xsl:key name="x" match="Table | Query"
> use="@name"/>
>   <xsl:output method="text"/>
>   <xsl:template match="Queries">
>     <xsl:for-each
> select="descendant::*[generate-id(.) =
> generate-id(key('x', @name))]">
>       <xsl:if test="key('x', @name)[parent::Query]">
>         <xsl:value-of select="@name"/>: <xsl:text/>
>         <xsl:for-each select="key('x', @name)">
>           <xsl:if test="not(position() = 1)">,
> </xsl:if>
>           <xsl:value-of select="../@name"/>
>         </xsl:for-each>
>         <xsl:text>
</xsl:text>
>       </xsl:if>
>     </xsl:for-each>
>   </xsl:template>
> 
> Cheers,
> 
> Jarno - Chris C: Vengeance Is Mine
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.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.