RE: [xsl] xpath trickery (was A Question **TO** XSLT Newbies)

Subject: RE: [xsl] xpath trickery (was A Question **TO** XSLT Newbies)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 25 Apr 2003 14:12:30 -0400
Mike,

At 06:54 PM 4/24/2003, you wrote:
> - variable in XPath seem to be allowed / disallowed in random ways.

A variable is allowed in precisely the same places as you can use a
literal value or a function call. What is random about that?

Well, to be fair to Simon, they also can't appear in any XPath expression being used as a match pattern.


In my experience disentangling this tight weave comes first from knowing where the dividing line between XPath and XSLT is ... as well as knowing where they depend on each other. E.g. that XPath leaves to its application (viz. XSLT) -- the determination of things like context size and position ... hence troubles understanding what position() and last() actually do.

Only when you have a clear grounding on what XPath does as an expression language does it become clearer why, for example, restrictions are placed on XPath in some -- not all -- places in XSLT. (That is, what's a match pattern and what's just XPath retrieving nodes.) This, in turn, requires a good grasp of the XSLT processing model.

I thought Simon's list of what's confusing about XPath was an excellent synopsis, and can only respond to him by recommending -- again -- that some time spent going over XPath *without trying to solve a particular problem!*, not only its syntax but (more importantly) its data model, datatypes, functions (since not all functions in use in XSLT are in XPath!) and (yes) casting rules -- is well worth it. If at all possible, with the help of an expert. If you have some help disentangling it -- and particularly if (as you say, Mike) you can avoid imposing mistaken notions and theories based on experience with other technologies or ideas of "should" -- it proves not to be all that hard after all.

Only time will tell whether this situation is bettered or worsened by XPath 2.0.
:->


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