Path Language

Parent Previous Next


Understanding the Workbench Path Language


The Workbench Path Language is a special path language, similar to XPath, that is used throughout Pragmatic Workbench to dynamically select specific objects. Though the syntax described below remains the same, the path language has different purposes depending on the feature that it is currently being used for. The path grammar outlined here is used within the following products and features:


  BI xPress

o   User Defined Best Practices: Used to evaluate rules. When the Path Language returns a valid that matches the evaluated path, then the rule is in violation

  DOC xPress

o   Custom Templates: Used throughout DOC xPress' document generation templates to control the Structure Maps and Templates

o   Metadata Viewer: Used to navigate the metadata for a DOC xPress Snapshot

o   Data Dictionary: Used to match custom category items to specific metadata object types within a DOC xPress Snapshot

  DOC xPress Server

o   Custom Templates: Used throughout DOC xPress Server's document generation templates to control the Structure Maps and Templates


Table of Contents

  Path Elements

  Separators

  Conditionals

o   Simple Conditionals

o   Related Path Conditionals

o   Negating Conditionals

o   Combining Conditionals


Introduction

Paths are composed of repeating groups of separators and path elements. Additionally, separators at the beginning or end of a path have special meaning. The general form is as follows:


Path: [<initial separator>] [ (<element> <separator>) .. n] <element> [<trailing separator>]

Separator: /, //, ^

Element: (., .., *, <object name>) [ conditional ]


Important Note:

When working with Path Grammar, the initial starting point, or scope, is exceptionally important when build a valid path.


Using this example tree we can see how we may navigate to certain areas using the path's navigation elements:



If we are starting at A, then to get to C the path would be:


B/C



If we are starting at A, then to get to G the path would be:


E/F/G



However, users may wish to get the set of all X nodes present within the whole tree, in which case the path would be:


//X



Or, users may wish to get all X nodes that are a descendant of B, in which case the path would be:


B//X



The importance of the initial and trailing separators can be demonstrated by considering the same tree, and starting at point D.


If we wanted to get to C, we could use one of the following paths:


../C




/B/C



Note that the single slash at the start of the path means ‘start from the root’, which in the case of the above tree, is A. This is also the meaning when starting with the double slash. So, starting from point D again, to get all X nodes we can use the notation:


//X



Trailing separators allow us to look at get all children. In order to get all children of node B from any point in the tree, we could use:


/B/



Alternatively, to get all descendants of B, we could use:


/B//