|
Subject: RE: [xsl] How to find all parents having the same child? From: Bita Jooooooon <bjooooooon@xxxxxxxxx> Date: Wed, 18 Jun 2003 14:34:12 -0700 (PDT) |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] How to find all parents h, Jarno . Elovirta | Thread | [xsl] Namespace attached to host do, David Golding |
| RE: [xsl] xsl:number problem, Wendell Piez | Date | Re: [xsl] Printing tax forms using , W. Eliot Kimber |
| Month |