[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Testing position of parent
>>>>> "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
|
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
|