|
Home > Online Product Documentation > Table of Contents > Using XPath Expressions in Stylesheets Using XPath Expressions in StylesheetsThis section provides information about using XPath expressions in stylesheets. It includes the following topics: Using VariablesIn a query that you specify in a stylesheet, you can refer to variables that you defined elsewhere in the stylesheet. Use the following format to refer to a variable:
In a stylesheet, you can define variables with either of the following instructions: Obtaining System PropertiesIn a query in a stylesheet, there are three system properties for which you can obtain information:
To obtain this information, call the
The string you specify must identify one of the three properties and must be a qualified name. This function returns an object that represents the value of the system property you specify. Determining If Functions Are Available
In a query in a stylesheet, to determine whether the XPath processor supports a particular function, call the
Specify a string that identifies the name of the function. The XPath processor returns
Obtaining the Current Node for the Current XSLT Template
In a stylesheet, the current node is the node for which the XSLT processor instantiates a template. When the XPath processor evaluates an expression during stylesheet processing, the initial context node for the expression is set to the current node for the stylesheet instruction that contains the expression. Because the context node can change during evaluation of subexpressions, it is useful to be able to retrieve, from within a subexpression, the original context node for which the expression is being evaluated. You can use the
The
For example, the following stylesheet causes the XSLT processor to pass the
The
The
Suppose the
In a query, the dot specifies the context node. This query would return a
You can nest
Finding an Element with a Particular Key
The
The first argument specifies the name of the key. The value of this argument must be a qualified name. The second argument specifies the node or nodes to examine. When the second argument is a node set, the result is the union of the results of applying the
Example
For example, the
When you display information about a video in a Web browser, you want to display the names of the actors. Because the actors are referenced only by an ID number, you create a key table in your stylesheet:
This indexes all actors by their ID. To process a video, your stylesheet specifies the following:
This instructs the XPath processor to look up the
Generating Temporary IDs for Nodes
The
Format
The format for the
The
If the node-set argument is empty, the
|
XML Schema-Aware Queries and Stylesheets
Learn how to simplify XSLT and XQuery applications using Schema Aware XSLT and XQuery processing technologies.
EDIFACT Sample Converted to XML
A sample EDIFACT document before and after conversion to XML, showing markup and full automatically-generated internal documentation.
XQuery Editor
Stylus Studio's XQuery development tools are a tremendous help in building and testing XML applications requiring a standards-based approach to querying, integrating and transforming data from various distributed data sources.
XML Publisher - XSLT Generator and XSL:FO Generator
The XML Publisher lets you easily design beautiful documents in HTML or PDF format from relational, XML and other data sources using XSL:FO or XSLT, using an intuitive visual interface.