Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 225

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="expressions" page="axissteps" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Axis steps</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: Axis steps"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Axis steps</h1>
      <p>The basic primitive for accessing a source document is the <i>axis step</i>. Axis steps 
may be combined into path expressions using the path operators <code>/</code> and <code>//</code>,
and they may be filtered using filter expressions in the same way as the result of any other
expression.</p>
      <p>An axis step has the basic form <code>axis :: node-test</code>, and selects nodes on a given axis
that satisfy the node-test. The axes available are:</p>
      <table>
         <tr>
            <td content="para">
               <p>ancestor</p>
            </td>
            <td content="para">
               <p>Selects ancestor nodes starting with the current node and ending
with the document node</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>ancestor-or-self</p>
            </td>
            <td content="para">
               <p>Selects the current node plus all ancestor nodes</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>attribute</p>
            </td>
            <td content="para">
               <p>Selects all attributes of the current node (if it is an element)</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>child</p>
            </td>
            <td content="para">
               <p>Selects the children of the current node, in documetn order</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>descendant</p>
            </td>
            <td content="para">
               <p>Selects the children of the current node and their children, recursively
(in document order)</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>descendant-or-self</p>
            </td>
            <td content="para">
               <p>Selects the current node plus all descendant nodes</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>following</p>
            </td>
            <td content="para">
               <p>Selects the nodes that follow the current node in document order,
other than its descendants</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>following-sibling</p>
            </td>
            <td content="para">
               <p>Selects all subsequent child nodes of the same
parent node</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>namespace</p>
            </td>
            <td content="para">
               <p>Selects all the in-scope namespaces for an element (this axis
is deprecated in XPath 2.0, but Saxon continues to support it)</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>parent</p>
            </td>
            <td content="para">
               <p>Selects the parent of the current node</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>preceding</p>
            </td>
            <td content="para">
               <p>Selects the nodes that precede the current node in document order,
other than its ancestors</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>preceding-sibling</p>
            </td>
            <td content="para">
               <p>Selects all preceding child nodes of the same
parent node</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>self</p>
            </td>
            <td content="para">
               <p>Selects the current node</p>
            </td>
         </tr>
      </table>
      <p>When the child axis is used, <code>child::</code> may be omitted, and when the attribute
axis is used, <code>attribute::</code> may be abbviated to <code>@</code>. The expression
<code>parent::node()</code> may be shortened to <code>..</code></p>
      <p><i>The expression <code>.</code> is no longer synonymous with <code>self::node()</code>,
since it may now select items that are not nodes. If the context item is not a node, any use of a
path expression will raise an error.</i></p>
      <p>The node-test may be, for example:</p>
      <ul>
         <li content="para">
            <p>a node name</p>
         </li>
         <li content="para">
            <p>
            <code>prefix:*</code> to select nodes in a given namespace</p>
         </li>
         <li content="para">
            <p>
            <code>*:localname</code> to select nodes with a given local name, regardless of namespace</p>
         </li>
         <li content="para">
            <p>
            <code>text()</code> (to select text nodes)</p>
         </li>
         <li content="para">
            <p>
            <code>node()</code> (to select any node)</p>
         </li>
         <li content="para">
            <p>
            <code>processing-instruction()</code> (to select any processing instruction)</p>
         </li>
         <li content="para">
            <p>
            <code>processing-instruction('literal')</code> to select processing instructions with the given name
            (target)</p>
         </li>
         <li content="para">
            <p>
            <code>comment()</code> to select comment nodes</p>
         </li>
         <li content="para">
            <p>
            <code>element()</code> or <code>element(*)</code> to select any element node</p>
         </li>
         <li content="para">
            <p>
            <code>element(N)</code> to select any element node named N</p>
         </li>
         <li content="para">
            <p>
            <code>element(*, T)</code> to select any element node whose type annotation
                     is T, or a subtype of T</p>
         </li>
         <li content="para">
            <p>
            <code>element(N, T)</code> to select any element node whose name is N
                    and whose type annotation is T, or a subtype of T</p>
         </li>
         <li content="para">
            <p>
            <code>schema-element(N)</code> to select any element node whose name is N,
            or an element in the substitution group of N, that conforms to the schema-defined
            type for a global element declaration named N in an imported schema</p>
         </li>
         <li content="para">
            <p>
            <code>attribute</code> or <code>attribute(*)</code> to select any attribute node</p>
         </li>
         <li content="para">
            <p>
            <code>attrbute(N)</code> to select any attribute node named N</p>
         </li>
         <li content="para">
            <p>
            <code>attribute(*, T)</code> to select any attribute node whose type annotation
                     is T, or a subtype of T</p>
         </li>
         <li content="para">
            <p>
            <code>attribute(N, T)</code> to select any attribute node whose name is N
                    and whose type annotation is T, or a subtype of T</p>
         </li>
         <li content="para">
            <p>
            <code>schema-attribute(N)</code> to select any attribute node whose name is N,
            that conforms to the schema-defined
            type for a global attribute declaration named N in an imported schema</p>
         </li>
      </ul>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="parentheses.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>