Harry Forbess
Harry Forbess

Reputation: 2134

how can I get a substring based of a character

Like if

    <email>[email protected]</email>

how can I get xsl to just give me smith.com?

Upvotes: 1

Views: 69

Answers (1)

Mads Hansen
Mads Hansen

Reputation: 66781

Use the function substring-after()

The substring-after function returns the substring of the first argument string that follows the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string. For example, substring-after("1999/04/01","/") returns 04/01, and substring-after("1999/04/01","19") returns 99/04/01.

<xsl:template match="email">
    <xsl:value-of select="substring-after(., '@')"/>
</xsl:template>

Upvotes: 1

Related Questions