| home / experts / xml / column17 |
|
|
A variable is a name that may be bound to a value. The value to which a variable is bound can be an object of any of the types that can be returned by expressions, namely node-sets, booleans, strings, and numbers. There are two elements that can be used to bind variables: xsl:variable and xsl:param. The difference is that the value specified on the xsl:param variable is only a default value for the binding; when the template or stylesheet within which the xsl:param element occurs is invoked, parameters may be passed that are used in place of the default values.
A variable-binding element can specify the value of the variable in three alternative ways. If the variable-binding element has a select attribute, then the value of the attribute must be an expression and the value of the variable is the object that results from evaluating the expression. In this case, the content must be empty. If the variable-binding element does not have a select attribute and has non-empty content (i.e. the variable-binding element has one or more child nodes), then the content of the variable-binding element specifies the value. The content of the variable-binding element is a template, which is instantiated to give the value of the variable. If the variable-binding element has empty content and does not have a select attribute, then the value of the variable is an empty string.
The primary purpose of XPath is to address parts of an XML [XML] document. Supporting this, it also provides basic facilities for manipulation of strings, numbers and booleans. XPath gets its name from its use of a path notation as in URLs for navigating through the hierarchical structure of an XML document, and a natural subset can be used for matching (testing whether or not a node matches a pattern) in XSLT.
Location paths select one node or a set of nodes in the document tree. They exist in normal and abbreviated syntax, where the latter mimics directory navigation behavior.
Here are some examples of location paths using abbreviated syntax:
Finally something about creating result elements, and the unevitable conclusion.
Produced by Michael Claßen
All Rights Reserved. Legal Notices.
URL: http://www.webreference.com/xml/column17/3.html
Created: Aug 13, 2000
Revised: Aug 13, 2000