RE: [xsl] Stepping through XPath in a visual XPath debugger

Subject: RE: [xsl] Stepping through XPath in a visual XPath debugger
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 31 Jul 2007 15:33:23 -0400
Hi,

At 01:08 PM 7/31/2007, Mike wrote:
> a) What is the most intuitive order in which to step-through
> an XPath 1.0 expression visually?

I really don't know the answer to this, but I think anything that presents a
view of the evaluation as a sequential process is misleading and likely to
be unhelpful. The concept should be to select parts of the expression and
understand what contribution they make to the result - for example, being
able to see which nodes a particular predicate is applied to, and which of
them match.

While admitting, in sympathy with this caution, that it is an academic exercise to view the evaluation of an XPath expression sequentially, it might be helpful to see how we've learned to teach neophytes to interpret XPath 1.0 location paths:


1. The concept of a step, each step being evaluated from the context of the previous step
2. Anatomy of a step:
2a Axis (required)
2b Node test (required)
2c Predicate(s) (optional)
3. Axes in detail
4. Node tests in detail
5. Predicates (as filters of sets of nodes)
6. Abbreviations (or, short vs long syntax)


It is of particular interest that XPath abbreviations sometimes have the effect of obscuring exactly what the axis and node tests are in a particular step. Accordingly, when we teach this subject at Mulberry, we lay some stress (how much depends on the class) on the long syntax, as it indicates explicitly just what is happening.

So I should think that a nice visualization of XPath would do, at least, the following:

1. Translate from short (abbreviated) syntax into long syntax
2. Discriminate between the steps in a path
3. Optionally, discriminate between the parts of each step
4. Show which nodes were selected in each step (perhaps identified in relation to the step's context)


Note that there have already been some worthy visualization tools for XPath, but nothing is a substitute for a concrete, meaningful example. While being able to visualize it generally is useful, it really clicks into place when students can see *why* particular XPaths are used in particular situations. This helps to dramatize which sorts of things matter (context nodes) and which ones don't (short or long syntax).

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
======================================================================

Current Thread