[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: sort by attribute text
Mike,
At 04:21 PM 3/26/2002, you wrote: Nice to know it was not my syntax. I guess I need to take another look at the book. Nope, it's not. It's the same thing as before, understanding how XPath expressions work, particularly in relation to the context node. select="*" gets you a different set of nodes depending on what the context is for the expression. This is a technical way of explaining why it usually matters what your template has matched on. At some point all this stuff should click. XPath is really quite simple once you've assimilated a few basic, but non-obvious facts. According to the spec (XPath 1), any expression is evaluated in a context, which includes: * a node (the context node) * a pair of integers: 1. the context size i.e. how many nodes were selected with this one is returned by the last() function 2. the context position i.e. which node is this one among the ones it was selected with is returned by the position() function * variable bindings in scope * available function library (XPath, XSLT, extension functions, etc.) * namespaces in scope In order to evaluate any arbitrary expression, the processor needs to know what all these are. In order to understand how your own XPath expressions work, it's helpful for you to know what they are, too. They're not hard to figure out: the context node, size and position are determined by the selection of nodes in your apply-templates or for-each instructions (or, in predicates, by the steps in your location paths). The others are either predefined, or directly under your control, or (in the case of namespaces in the source) static with respect to the source document. But many beginners have not assimilated that even the first one, the context node, matters -- and it's often downhill from there. Cheers, Wendell
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
|