[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: $5 PAYPAL for correct answer still not claimed! Se
Please disregard prior... premature send.
At 03:05 20-07-2001, David Glover wrote: I wish to return all brands/lines/items that have this @OFFER attribute. This is the confusing part. What do you mean by "return"? An XPath expression matches nodes. You could have an expression that matches the brands, or, lines, or items, or all of them, but it's not clear what the value of matching all of them would be. Now, if by "return" you mean "copy into the result tree", i.e. copy the source tree but prune any branches that don't have offers, then what you probably want to do is have a template that matches any BRAND with an offer on any descendant, and then only process the ITEMs with any offers, etc. <!-- by default, don't copy anything --> <xsl:template match="BRAND | LINE | ITEM" priority="1"/> <!-- if there are children with offers, copy this element and then look at its children one by one --> <xsl:template match="BRAND[LINE/@OFFER or LINE/ITEM/@OFFER] | LINE[ITEM/@OFFER]" priority="2"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <!-- if this one has the offer, copy it and all its descendants --> <xsl:template match="BRAND[@OFFER] | LINE[@OFFER] | ITEM[@OFFER]" priority="3"> <xsl:copy-of select="."/> </xsl:template> Based on your example, this should do what you want. HTH, Chris -- Christopher R. Maden, XML Consultant DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training <URL: http://crism.maden.org/consulting/ > PGP Fingerprint: BBA6 4085 DED0 E176 D6D4 5DFC AC52 F825 AFEC 58DA XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|