[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Count elements A up to any element B in an axis
Hello, using XSLT 2. Effectively, I need to determine the level of a (possibly nested) list I (=context node) am at. I thought I would do this by counting my ancestor list elements A. However, certain elements along that axis establish a new level-counting context (e.g. a table cell or a footnote, B), so I only want to count until such an element first appears in the ancestor chain. My current solution is count( ancestor-or-self::A[ . >> ancestor::node()[self::B or /][1] ] ) Is this a correct and good way (both in being a generic enough pattern to re-use for such problems and performance) to do it, or are there better ways? -Christian
|
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
|