This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: $5 PAYPAL for correct answer still not claimed! Searching for an attribute across different elements with ancestoral elements returned
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] $5 PAYPAL for correct answer still not claimed! Searching for an attribute across different elements with ancestoral elements returned
- From: "Robert Koberg" <rob at koberg dot com>
- Date: Fri, 20 Jul 2001 08:15:47 -0700
- References: <A98800D7FF0DD411808A0090274F59F7091E3C@atcexch6.istl.icl.co.uk>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Totally untested, but how about something like:
<xsl:variable name="myvar">
<xsl:apply-templates select="*[@OFFER]" mode="something"/>
</xsl:variable>
------------------------
<xsl:template match="*[@OFFER]" mode="something">
<xsl:copy/>
</xsl:template>
----- Original Message -----
From: "Bedwell Tom" <Tom.Bedwell@icl.com>
To: <xsl-list@lists.mulberrytech.com>
Sent: Friday, July 20, 2001 4:14 AM
Subject: RE: [xsl] $5 PAYPAL for correct answer still not claimed! Searching
for an attribute across different elements with ancestoral elements returned
> I wish to return all brands/lines/items that have this @OFFER attribute.
> If it is an ITEM I wish to return its parent LINE and grandparent BRAND as
> well. If it is a LINE, I wish to return its child ITEMs and parent BRAND
as
> well. If it is BRAND I wish it to return its child LINEs and its
> grandchildren ITEMs. I DO NOT WANT any siblings of the matched element.
>
>
> ______________________________
>
> Transform the problem so you look at the attributes of decendants and you
> get a solution like this.
>
>
> <!-- This copies any element having a descendant with an OFFER attribute
> -->
>
> <xsl:template match="*[descendant::*[@OFFER]]">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:apply-templates select="*"/>
> </xsl:copy>
> </xsl:template>
>
> <!-- this duplicates an offer element and all its descendants-->
> <xsl:template match="*[@OFFER]">
> <xsl:copy-of select="."/>
> </xsl:template>
>
>
> Tom
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list