Re: Testing position of parent

Subject: Re: Testing position of parent
From: dkarr@xxxxxxxx (David M. Karr)
Date: 26 Oct 2000 09:48:41 -0700
>>>>> "Kay" == Kay Michael <Michael.Kay@xxxxxxx> writes:

  >> if the parent is an <LG> which has first position among its
  >> siblings, then do X, otherwise do Y

  Kay> Try test="parent::lg[not(preceding-sibling::*)]"
  >> 
  >> Here's what I thought would be the expression to accomplish that:
  >> 
  >> <xsl:when test="parent::lg[position()=1]">

  Kay> This looks at its position among all the parent::lg elements of the current
  Kay> node

I always find it interesting to compare your responses with what David
Carlisle says.  Considering how obtuse test and path expressions can
be to newbies (which I still count myself), it's amazing how often
your two answers are almost identical.  However, on this question I
notice that your suggestion is slightly different from David's
suggestion.  I believe they will return the same result, but I'm
wondering if there's any tradeoffs to each approach.

You said:      test="parent::lg[not(preceding-sibling::*)]"
David C. said: test="not(parent::lg[preceding-sibling::*])"

Will there be any performance or other tradeoffs to these two
expressions?  Are there any general guidelines for understanding the
performance differences between two expressions like these?

-- 
===============================================================================
David M. Karr     ; dkarr@xxxxxxxx  ; w:(425)487-8312 ; TCSI & Best Consulting
Software Engineer ; Unix/Java/C++/X ; BrainBench CJ12P (#12004)


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread