Re: Q: pattern selection for outside the context node

Subject: Re: Q: pattern selection for outside the context node
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Fri, 9 Jul 1999 09:59:56 -0400 (EST)
At 8 Jul 1999 18:24 -0700, G. Ken Holman wrote:
 > According to 6.1.1 there are 12 axes you can choose from when building a
 > pattern:
 > 
 >  [5] AxisIdentifier ::=  'from-ancestors'
 >                        | 'from-ancestors-or-self'
 >                        | 'from-attributes'
 >                        | 'from-children'
 >                        | 'from-descendants'
 >                        | 'from-descendants-or-self'
 >                        | 'from-following'
 >                        | 'from-following-siblings'
 >                        | 'from-parent'
 >                        | 'from-preceding'
 >                        | 'from-preceding-siblings'
 >                        | 'from-self'

These are good for location paths, but not for patterns.  Section 6.3
states:

   A pattern must match the grammar for Pattern. A Pattern is set of
   location path patterns separated by |. A location path pattern is a
   location path none of the steps of which use either AxisIdentifiers
   or . or ... Location path patterns can also start with an id() or
   key() function call with a literal argument (see [6.2.2
   Node-sets]). Predicates in a pattern can use arbitrary expressions
   just like predicates in a location path.

 > And according to 6.1.4 there are abbreviations available to be used to
 > address 5 of the axes:
 > 
 >     .       refers to   from-self
 >     @name   refers to   from-attributes   (name of "*" means "all")
 >     name    refers to   from-children     (name of "*" means "all")
 >     ..      refers to   from-parent
 >     //      refers to   from-descendants

But you can't use "." or ".." in a pattern.

 > When the pattern starts with "/", the orientation is from the root of the
 > tree.
 > 
 > The pattern can be comprised of a number of location steps, each step
 > delimited by "/".
 > 
 > The function id() described in 6.2.2 allows you to, in a location step,
 > refer to a node or nodes with unique identifiers.

Provided you specify the ID as a literal string.

 > The function key() is similar to id() in that it allows you to refer to a
 > node or nodes elsewhere in the document, but it does so without the
 > reference needing to be a node with a unique identifier.  There is a short
 > description of the power of the key() function in the free resources
 > section of our web site.

Provided you use literal arguments.

Regards,


Tony Graham
======================================================================
Tony Graham                            mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9632
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