RE: returning single result from apply-templates
Mike Kay had a good explanation of this in his book, on the abbreviated syntax of XPath absolute and relative path expressions (pp. 326-330). // is short for /descendant-or-self::node()/ Note that it is interestingly not an abbreviation for one step. Instead, it's an abbreviation for one step + "/". Thus, <xsl:apply-templates select="//"/> is invalid, because it's akin to adding a slash to the end of an XPath expression. Thus, if you keep in mind the fact that //foo actually consists of two XPath steps, you should avoid this confusion in the future. David's solution will work, because it assigns the predicate to the foo//bar overall node-set rather than to each intermediate bar node-set. The following will also work, and may be more straightforward (consisting of two steps rather than three): <xsl:apply-templates select="foo/descendant::bar"/> Hope this helps, Evan Lenz elenz@xxxxxxxxxxx http://www.xyzfind.com XYZFind, the search engine *designed* for XML Download our free beta software: http://www.xyzfind.com/beta -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of David Carlisle Sent: Monday, October 09, 2000 10:42 AM To: xsl-list@xxxxxxxxxxxxxxxx Cc: xsl-list@xxxxxxxxxxxxxxxx Subject: Re: returning single result from apply-templates > If I do > > <xsl:apply-template select="foo//bar"/> > > I get but you don't if you do <xsl:apply-template select="(foo//bar)"/> David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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