| Subject: Re: [xsl] namespace aware template matching From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 27 Oct 2005 10:14:47 +0100 | 
> if so, is one any better/faster than the other?, or are they completely 
> different somehow?
they are different.
ancestor::ns:article[1] finds the nearest ancestor ns:article
ancestor::ns:*[1][self::article] finds the nearest ancestor ns:*
            element if it is an article, and nothing otherwise.
so if you have
<ns:article>
  <sadjfg>
     <ns:wibble>
       <lkjgh>
          <ns:id>
the ns:id element matches
ns:id[ancestor::ns:article[1]]
but not
ns:id[ancestor::ns:*[1][self::article]]
I understood from your description that you wanted the form that I gave,
but if you actually wanted the form that you gave, then use that
instead:-)
If that is the form you wanted, then possibly you may also be happy
with the much simpler form
match="ns:root//ns:article//ns:id"
which in some edge cases left as an excercise to the reader isn't
equivalent to either of the forms above, but may well address your real
use case.
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] namespace aware template , tom . kirkpatrick | Thread | [xsl] xsl:import and xsl:apply-impo, Mike Ferrando | 
| Re: [xsl] namespace aware template , tom . kirkpatrick | Date | Re: [xsl] foreach, preceding-siblin, David Carlisle | 
| Month |