home contribute faq download

FunctX XSLT Functions

functx:reverse-string

Reverses the order of characters

Google
Webxsltfunctions.com

Description

The functx:reverse-string function reverses the order of characters in a string. It returns a zero-length string if the argument is the empty sequence.

Arguments and Return Type

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

XSLT Function Declaration

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

  <xsl:sequence select="
   codepoints-to-string(reverse(string-to-codepoints($arg)))
 "/>

</xsl:function>

Examples

XPath ExampleResults
functx:reverse-string('abc')
cba
functx:reverse-string('a')
a

See Also

fn:reverseReverses the order of a sequence

History

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

Recommended Reading:

XQuery