Returns a String


Each function in Table 6.3 returns a string.

Table 6.3: XPath 1.0 functions that return a string
Open table as spreadsheet

Function

Meaning

concat(string, string, )

Concatenates any number of string arguments. The following expression resolves to Buick Skylark.

concat('Buick ', 'Sky', 'lark')

name(node set)

Returns the name of the first node in the node set. Given our main example, the following expression resolves to CarPolicy, which is the name of the first retrieved node

name(/Insured/*)

normalize-space(string)

Removes leading and trailing spaces and removes all but one space when multiple white-space characters (carriage returns, spaces, tabs) are between other characters. The following expression resolves to Buick Skylark

normalize-space(' Buick Skylark ')

substring(string, number, number)

Returns a substring of the first argument, starting at a specified position (the first number). The substring continues for a specified number of characters (the second number) or (if the second number is omitted) returns the rest of the string.

Each of the following expressions resolves to Speed

substring('Porsche Speedster', 9, 5)

substring('Porsche Speed', 9)

substring-after(string, string)

Returns a substring of the first argument, starting at one position after the first occurrence of the second string.

The following expression resolves to a space, then Speedster.

substring-after('Porsche Speedster', 'e')

substring-before(string, string)

Returns a substring of the first argument, starting at the beginning of the first argument and ending at one position before the first occurrence of the second string.

The following expression resolves to Porsche, then a space.

substring-before('Porsche Speedster', 'S')

translate(string, string, string)

Returns a variant of the first argument:

  • Changes any character that matches a character listed in the second argument

  • Substitutes a character listed in the third argument. If no substitution value is listed there, the character is not returned from the function

The second and third arguments are a matching array of characters. If the third argument is longer than the second, the extra positions have no effect. If the third argument is shorter than the second, the missing position removes a character from the returned string.

The second example in the next table shows a character removal.

 

Invocation

Returns

 

translate('98786', '8', 'X')

9X7X6

 

translate('98786', '87', 'X')

9XX6

 

translate('98786', '87', 'XPA')

9XPX6




SOA for the Business Developer. Concepts, BPEL, and SCA
SOA for the Business Developer: Concepts, BPEL, and SCA (Business Developers series)
ISBN: 1583470654
EAN: 2147483647
Year: 2004
Pages: 157
Authors: Ben Margolis

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net