Description
The functx:substring-after-if-contains function performs substring-after, returning the entire string if it does not contain the delimiter. It differs from the built-in fn:substring-after function, which returns a zero-length string if the delimiter is not found.
Arguments and Return TypeName | Type | Description |
$arg |
xs:string? |
the string to substring |
$delim |
xs:string |
the delimiter |
return value |
xs:string? |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:substring-after-if-contains" as="xs:string?"
xmlns:functx="http://www.functx.com">
<xsl:param name="arg" as="xs:string?"/>
<xsl:param name="delim" as="xs:string"/>
<xsl:sequence select="
if (contains($arg,$delim))
then substring-after($arg,$delim)
else $arg
"/>
</xsl:function>
|
ExamplesXPath Example | Results |
---|
functx:substring-after-if-contains('abcd','b') |
cd |
functx:substring-after-if-contains('abcd','x') |
abcd |
See AlsoHistory |
Recommended Reading:
|