This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: simple XPath question
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] simple XPath question
- From: "Chris Nolte" <nolte at silicon-age dot com>
- Date: Tue, 3 Jul 2001 12:57:26 -0700
- Organization: Silicon Age, Inc.
- References: <5.0.2.1.0.20010702181646.02684270@earthlink.net>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Wendell Piez:
> But a more robust match to do what you want would be
>
> <xsl:template match="country[not(preceding::country)]" >
Mike Kay suggested something along the lines of:
<xsl:template match='item[1]/country'>
Thank you both, these XPath expressions produce the desired result. Your
explanations (and Jeni's) were quite helpful.
The nominal purpose of this example given in Fung's book (in which it fails,
as far as I can tell) is to demonstrate template priority, and that
<xsl:template match='country[1]'> has a higher priority than <xsl:template
match='country'>. Accordingly, the solution Thomas Passin and Jeni Tennison
posed of using <xsl:when
test='position()=1'><first-country>...</first-country></xsl:when> ... inside
a template matching 'country' is contrary to the purpose of the example,
though it is certainly a viable approach.
Chris
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list