XPath Function Blocks

Stylus Studio supports standard XPath functions defined by the W3C. This section describes how to work with function blocks in XSLT mapper and covers the following topics:

Parts of a Function Block

Function blocks are drawn as a purple block with an italic " f" at its center, and connectors, called ports, placed along the block's border. Input ports (one or more depending on the function) on the left, the flow port at the top, and the output port on the right:

Figure 199. Function Block

Input ports

Input ports are on the left side of the function block. The number and definition of input ports varies from function to function. To specify a value for an input port, you can

  • Drag a source document element or attribute to the port and release it
  • Double-click the port and enter the function in the Value dialog box
Flow port

Flow ports on the top of function blocks are generally used only when a function is used in a direct link between a source and target node.

Output port

The output port is on the right side of the function block. You use the output port to map the function result directly to a target structure element or attribute, or to an IF, condition, or another function block.

Types of Function Blocks

The XPath functions available in XSLT mapper include the following:

  • boolean
  • ceiling
  • concat
  • contains
  • count
  • floor
  • format
  • last
  • local-name
  • mod
  • name
  • normalize-space
  • number
  • position
  • round
  • starts-with
  • string
  • string-length
  • substring
  • substring-after
  • substring-before
  • sum
  • translate

XPath Mathematical Functions

In order to simplify the graphical presentation in the XSLT mapper, the following XPath mathematical functions are not graphically represented:

  • add
  • div
  • multiply
  • subtract

You can easily express these functions by typing them in the Value dialog box displayed when you double-click an input port.

Creating a Function Block

To create a function block:
1. In the XSLT editor, in the Mapper tab, right-click mapper canvas.
2. In the shortcut menu that appears, click XPath Functions and slide to the submenu.
3. Click the function you want to use. Stylus Studio displays a function block for the function you selected.

Deleting a Function Block

To delete a function block:

Select it and press the Delete key.

If the function block is part of a link, deleting the function block also deletes the link.

Technology Companies That Use Stylus Studio

Technology companies can't always handle every technology that they come across. That's why when it comes to XML, they look to Stylus Studio to guide them. Check out which top technology companies are looking to the future with Stylus Studio.

DOM - The Document Object Model

The Document Object Model (DOM) is a cross-platform interface for parsing and manipulating XML. Learn how Stylus Studio supports DOM in our XML Pipeline and other XML parsing tools.

XSL:FO Editor

The XSL-FO editor provides syntax help, code completion integrated PDF preview, and integration with industry-leading XSL-FO processors including RenderX XEP and Apache FOP. Simplify XSL FO development with Stylus Studio.

Web Service Testing Tools

The Stylus Studio Web Service Tester allows you to easily locate, build references to, and test Web services for XML applications based on WSDL, SOAP, and UDDI standard Web service technologies.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member