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

Re: Questions on the new XSL spec (section 2.6)

Subject: Re: Questions on the new XSL spec (section 2.6)
From: James Clark <jjc@xxxxxxxxxx>
Date: Tue, 29 Dec 1998 12:52:03 +0700
Re: Questions on the new XSL spec (section 2.6)
Steve Dahl wrote:
> 
> In section 2.6, the new pattern rules seem confusing to me:
> 
>     Can '.', '..', ancestor(), ancestor-or-self(), and id() appear in
> match patterns, or only in select patterns?

Yes.

>     What does it mean when they occur in a match pattern, if that's
> permitted?

See 2.6.2 under Matching, second paragraph.  These are kind of confusing
when used as match patterns; one case is definitely useful:

 id("foo")

matches an element with ID "foo".

>     Can these patterns appear in a SubtreeExpr? In other words, can they
> appear as a "child" of another pattern? For example, is
> 'a/b/ancestor(c)/d' a permitted pattern?

Yes.

>     If this is permitted, what does it mean if they are preceded by '/'?

See 2.6.2 under Composition.

As a select pattern:

 foo selects foo element children

 / does composition, so foo/bar means for each foo child, select each
bar child.

As a useful example, consider

foo/id(@ref)/bar

This finds foo children of the current node, then gets the ref attribute
of each foo child, finds the element that each such attribute
references, then finds the bar child of each such element.

> What does it mean if they are preceded by '//'?

See 2.6.2 under Subtrees.

foo//bar

means

  for each node X in the foo element children of the current node
    for each node Y in the subtree rooted at X
       select the bar children of Y

Thus

  foo//..

would mean

  for each node X in the foo element children of the current node
    for each node Y in the subtree rooted at X
       select the parent of Y

It's well-defined but not terribly useful (XT doesn't currently
implement any of the cases you mention in match patterns).

>     It's possible in the new pattern syntax to have '@x' followed
> immediately by '/'. But '@x/y' is a pattern that doesn't seem to make
> any sense. 

It makes sense; it just can't ever match a node.

> What kinds of NodeExpr are allowed to follow an
> AttributeExpr, when they are separated by '/' or '//'?

Any kind.

> Similarly, what
> kinds of NodeExpr are allowed to follow a TextExpr, CommentExpr, or
> PiExpr?

Any kind.

James



 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.