Subject: Re: [xsl] Searching for an attribute used across different elements $5 PAYPAL for correct answer! From: "Robert Koberg" <rob@xxxxxxxxxx> Date: Thu, 19 Jul 2001 10:45:21 -0700 |
//*[@OFFER] ----- Original Message ----- From: "David Glover" <david@xxxxxxxxxxxxxxxxx> To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, July 19, 2001 10:16 AM Subject: [xsl] Searching for an attribute used across different elements $5 PAYPAL for correct answer! > I have a Products XML file that is of the following simple form : > <BRAND> > <LINE ID="1"> > <ITEM OFFER="BUYXGET1FREE"/> > <ITEM/> > <ITEM/> > <ITEM/> > </LINE> > <LINE ID="2"> > <ITEM/> > <ITEM/> > <ITEM/> > <ITEM/> > </LINE> > <LINE ID="3" OFFER="BUYXGET1FREE"> > <ITEM/> > <ITEM/> > <ITEM/> > <ITEM/> > </LINE> > </BRAND> > > At any level an @OFFER attribute is used to indicate a special deal > applicable to the whole level and its children. > > 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. > > I've tried the following 2 patterns : > > //BRAND/LINE[@OFFER] | //BRAND/LINE[ITEM[@OFFER]] | > //BRAND/LINE[ITEM[@OFFER]] > The problem with this was, that siblings were returned. > > //*[@OFFER] > The problem with this was it failed to return parents of the matched items. > > Given the above example XML and the correct XPATH expression I'm looking for > the following returned XML : > <BRAND> > <LINE ID="1"> > <ITEM OFFER="BUYXGET1FREE"/> > </LINE> > <LINE ID="3" OFFER="BUYXGET1FREE"> > <ITEM/> > <ITEM/> > <ITEM/> > <ITEM/> > </LINE> > </BRAND> > > Payment to the 1st geezer with the RIGHT answer. > ENTERNALLY greatful for any help offered! :) > > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Searching for an attribute us, David Glover | Thread | [xsl] xsl StreamSource for servlet, Robert Koberg |
Re: [xsl] newline white space, Jeni Tennison | Date | Re: [xsl] parent -child, srikanth |
Month |