home contribute faq download

FunctX XSLT Functions

functx:left-trim

Trims leading whitespace

Google
Webdatypic.com

Description

The functx:left-trim function removes all whitespace at the beginning of a string. Whitespace is defined as it is in XML, namely as the characters space, tab, carriage return and line feed. If $arg is the empty sequence, it returns a zero-length string.

Arguments and Return Type

NameTypeDescription
$arg xs:string? the string to trim
return value xs:string

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:left-trim" as="xs:string"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="arg" as="xs:string?"/>

  <xsl:sequence select="
   replace($arg,'^\s+','')
 "/>

</xsl:function>

Examples

XPath ExampleResults
functx:left-trim('   xyz')
xyz
functx:left-trim('   xyz    x')
xyz    x
functx:left-trim('xyz')
xyz

See Also

functx:trimTrims leading and trailing whitespace
functx:right-trimTrims trailing whitespace
fn:normalize-spaceNormalizes whitespace

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, https://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery