The normalize-space() function
Smartsite 7.4 - ...
The normalize-space() XPath 2.0 function returns the value of arg with leading and trailing whitespace removed, and sequences of internal whitespace reduced to a single space character.
XML | Copy Code |
---|---|
string fn:normalize-space(arg) |
Parameters:
- arg: a node reference or literal.
Example
XML | Copy Code |
---|---|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:exf="http://smartsite.nl/namespaces/xforms/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions"> <head> <title>Example</title> <xf:model> <xf:instance> <data xmlns=""> <tekst> The normalize-space() function removes leading and trailing spaces from the specified string, and replaces all internal sequences of whitespace with one. </tekst> </data> </xf:instance> </xf:model> </head> <body> <xf:group> <xf:output value="fn:normalize-space(' The normalize-space() function. ')" /> <xf:output value="fn:normalize-space(tekst)" /> </xf:group> </body> </html> |
The result will be:
The normalize-space() function.
The normalize-space() function removes leading and trailing spaces from the specified string, and replaces all internal sequences of whitespace with one.
The normalize-space() function removes leading and trailing spaces from the specified string, and replaces all internal sequences of whitespace with one.
Namespace
This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).