xsl-list
[Top] [All Lists]

Re: namespace aware template matching

2005-10-27 02:14:47

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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>