Home > References

XPath supported syntax

XPath notations used in EBX.Platform must conform to the abbreviated syntax of XML Path Language (XPath) Version 1.0 , with some restrictions. This document details which abbreviated syntax is actually supported.

The XPath general expression is: localisation [ predicate ]


Examples

Absolute path localisation:

/library/books/

Relative path localisations:

./Author

../Title

Root and descendant path localisations:

//books

Table path localisations with predicate:

../../books/[author_id = 0101 and (publisher = 'harmattan')]

/library/books/[not(publisher = 'dumesnil')]

Complex predicates:

starts-with(col3,'xxx') and ends-with(col3,'yyy') and not(osd:is-null(./col3))

contains(col3 ,'xxx') and ( not(col1=100) and date-greater-than(col2,'2007-12-30')

XPath expression syntax specification

General

Expression

Composition

Note/example

XPath expression

<container path>[predicate]

/books[title='xxx']

<container path>

<absolute path> | <relative path>

<absolute path>

/a/b | //b

//books

<relative path>

../../b | ./b | b

../../books

Predicate

Expression

Composition

Note/example

<predicate>

Ex: A and ( B or not(C) ) A,B,C: <atomic expression>

Composition of: logical operators braces, not() and atomic expressions.

<atomic expression>

<path><comparator><criterion> |method(<path>,<criterion>)

royalty = 24.5 starts-with(title, 'Johnat')booleanValue = true

<path>

<relative path>

Relative to the table wich contains it../authorstitle

<comparator>

<boolean comparator> | <numeric comparator> | <string comparator>

<boolean comparator>

=, !=

<numeric comparator>

=, !=, <, >, <=, >=

<string comparator>

=

<method>

<date method > | <string method > | osd:is-null method

<date, time & dateTime method >

date-less-than, date-equal, date-greater-than

<string method >

matches, starts-with, ends-with, contains

<criterion>

<boolean criterion> | <numeric criterion> | <string criterion> | <date criterion> | <time criterion> | <dateTime criterion>

<boolean criterion>

true, false

<numeric criterion>

integer or decimal

-4.6

<string criterion>

Quoted character string

'azerty'

<date criterion>

Quoted formated: 'yyyy-MM-dd'

'2007-12-31'

<time criterion>

Quoted formated: 'HH:mm:ss' or 'HH:mm:ss.SSS'

'11:55:00'

<dateTime criterion>

Quoted formated: 'yyyy-MM-ddTHH:mm:ss' or 'yyyy-MM-ddTHH:mm:ss.SSS'

'2007-12-31T11:55:00'

Extraction of foreign keys

In EBX.Platform, the foreign keys are grouped in a single field with the osd:tableRef declaration. The standard XPath syntax is augmented so as to extract the value of any targeted primary key field.

For example, if the table /root/tableA has a tableRef field named fkB whose target is /root/tableB and the primary key of tableB has two fields, id of type xs:int and date of type xs:date, then the following expressions will be valid:

Home > References