beautypg.com

Adobe Dreamweaver CC 2015 User Manual

Page 530

background image

523

XML

Last updated 6/3/2015

The XPath Expression Builder is a Dreamweaver feature that lets you build simple XPath expressions for identifying
specific nodes of data and for repeating regions. The advantage of using this method instead of dragging values from
the XML schema tree is that you can format the value that is displayed. The current context is identified based on the
position of the insertion point in the XSL file when the XPath Expression Builder dialog box is opened. The current
context is in boldface type in the XML schema tree. As you make selections within this dialog box, the correct XPath
statements, relative to your current context, are generated. This simplifies the process of writing correct XPath
expressions for beginners and advanced users.

Note: This feature is designed to help you build simple XPath expressions to identify a specific node or for repeating regions.
It does not allow you to edit the expressions by hand. If you need to create complex expressions, use the XPath Expression
Builder to get started and then customize your expressions in Code view or with the Property inspector.

Create an XPath expression to identify a specific node

1

Double-click the XML data placeholder on the page to open the XPath Expression Builder.

2

In the XPath Expression Builder (Dynamic Text) dialog box, select any node in the XML schema tree.

The correct XPath expression is written in the Expression box to identify the node.

Note: If you select a different node in the XML schema tree, the expression changes to reflect your choice.

In the following example, you want to display the price subelement of the item node:

This selection would insert the following code in your XSLT page:

3

(Optional) Select a formatting option from the Format pop-up menu.

Formatting a selection is useful when the value of your node returns a number. Dreamweaver provides a predefined
list of formatting functions. For a complete list of available formatting functions and examples, see the Reference
panel.

In the following example, you want to format the price subelement as a currency with two decimal places: