Setting XPath Expression Builder (Dynamic Text) dialog box options

Setting XPath Expression Builder (Dynamic Text) dialog box options

The purpose of this dialog box is to select a value in your XML data to display on your page. Dreamweaver inserts a <xsl:value-of/> tag at the insertion point. 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.

One of the advantages of the XPath Expression Builder is that it identifies the current context based on your position in the XSL file when the dialog box is opened. The current context is in boldface type in the XML schema tree. As you make selections within this dialog box, it generates the correct XPath statements relative to your current context. This simplifies the process of writing correct XPath expressions for both beginners and advanced users.

XPath (XML Path Language) is a non-XML syntax for addressing portions of an XML document. It is used mostly as a query language for XML data, just as the SQL language is used to query databases. For more information on XPath, see the XPath language specification on the W3C website at www.w3.org/TR/xpath.

It is important to note that this dialog box is designed to help you build simple XPath expressions to identify a specific node. It does not allow you to edit the expressions by hand. If you need to create complex expressions, use this dialog box to get started and then customize your expressions in Code view or with the Property inspector.

To select a value to display on your page:

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

    Dreamweaver writes the correct XPath expression in the Expression text box to identify the node.

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

    This is a picture of the feature being described.

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

    <xsl:value-of select="price"/>
    
  2. If you want, 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:

    This is a picture of the feature being described.

    These options would insert the following code in your XSLT page:

    <xsl:value-of select="format-number(provider/store/items/item/price,'$#.00')"/>
    
  3. Click OK.
  4. To display the value of each node in the XML file, apply a repeat region to the element containing the dynamic text (for example, an HTML table row or a paragraph).

    For more information, see Displaying repeating XML elements.

For more information and examples on selecting nodes to return a value, see the <xsl:value-of/> section in the Reference panel.



Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly
 
ASPTreeView.com
 
Evaluation has ·СХЙіЛЩЙєРУexpired.
Info...