|
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
|
DataDirect XML Converters Video Demonstration
DataDirect XML Converters are Java and .NET components that enable access to any data (flat files, EDI) from your application code. Learn how to deploy XML applications today.
EDI Mapping
To transform EDI to XML, whether for X12 or EDIFACT, Stylus Studio provides the design tools and run-time support. EDIFACT, X12 and custom EDI formats can be translated, validated and mapped using the EDI Mapping adapter technology described here.
XQuery API for Java (XQJ)
DataDirect XQuery is an embeddable software product based on the XQuery and XQJ standards that enables Java developers to access both relational and XML data sources using a single XQuery query. Runs on Oracle, SQL Server, DB2, and more!
XML Applications
XML Applications are software applications that process data using standard XML technologies like XML, XML Schema, XSLT and XQuery. Using Stylus Studio XML Pipeline, learn how to model, edit, test and deploy an XML Application with ease.