[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: sort by attribute text

Subject: Re: sort by attribute text
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 26 Mar 2002 17:23:40 -0500
xpath sort by attribute
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


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.