Breaking News
yeni film izle hd film seyret film izle

Node Tests & Axis Specifiers

Node Tests & Axis Specifiers
Node tests are most frequently element names, but other node tests are possible: name
Matches <name> element nodes
*
Matches any element node
namespace:name
Matches <name> element nodes in the specified namespace
namespace:*
Matches any element node in the specified namespace
comment()
Matches comment nodes
text()
Matches text nodes
processing-instruction()
Matches processing instructions
processing-instruction(‘target’)
Matches processing instructions with the specified target (<?target …?>
node()
Matches any node
This table lists seven proprietary XSLT elements created by Microsoft for some of its implementations of the XSLT technology. These are not part of the W3C XSLT standard.
Element Name Description
xsl:cdata Creates and adds a new CDATA section which allows you to use markup elements without violating the XML well-formed requirements.
xsl:define-template-set Defines a new set of templates.
xsl:entity-ref Creates and adds an entity reference node.
xsl:eval Evaluates a script expression and generates a string that can appear in the output.
xsl:node-name Adds the current node name to output.
xsl:pi Generates a processing instruction in the output.
xsl:script
msxsl:script
Creates a scripting area in a template in which you can declare global variables and define functions. msxsl:script is used by the latest Microsoft XML implementation (version 3.0). It is a child of the xsl:stylesheet element and has two attributes: language which defines the scripting language (the default is JScript) and implementation-prefix which declares the associated namespace.
Predicates
Predicates occur after the node test in square brackets. A wide range of expressions are possible.
nodetest[1]
Matches the first node
Most node tests return nodes in document order, only the tests which select ancestor or preceding elements return nodes in reverse document order. The practical result of this is that the “first” node is almost always the one closest to the context node, although parenthesis can change the effective order.
nodetest[position()=last()]
Matches the last node
nodetest[position() mod 2 = 0]
Matches even nodes
element[@id=’foo’]
Matches the element(s) with id attributes whos value is “foo
element[not(@id)]
Matches elements that don’t have an id attribute
author[firstname=”Norman”]
Match <author> elements that have <firstname> children with the content “Norman“.
author[normalize-space(firstname)=”Norman”]
Match “Norman” without regard to leading and trailing space. Predicate expressions can be more-or-less arbitrarily complex.
Axis Specifiers
The axis of a node test determines what general category of nodes may be considered for the following node test. There are thirteen axes:
ancestor
Ancestors of the current node

ancestor-or-self 
Ancestors, including the current node

attribute 
Attributes of the current node (abbreviated “@”)

child 
Children of the current node (the default axis)

descendant
Descendants of the current node

descendant-or-self 
Descendants, including the current node (abbreviated “//”)

following / following-sibling
Elements which occur after the current node, in document order

preceding / preceding-sibling
Elements which occur before the current node, in document order (returned in reverse-document order)

namespace
The namespace nodes of the current node

parent
The parent of the current node (abbreviated “..”)

self
The current node (abbreviated “.”)

The following graphic, courtesy of Crane Softwrights, demonstrates the axes graphically: