1

我想从 XSLT 中的电子邮件地址中提取名字的第一个字母和整个第二个名字。不确定我是否必须使用子字符串然后使用 concat 函数或如何做,因为我不知道电子邮件字符的标准长度。

输入:eman.ahmed@yahoo.com

所需输出:eahmed

<xsl:value-of select="ws:Additional_Information/ws:User_Name_Of_Employee/text()"/>

应该是这样的:<xsl:value-of select="substring(ws:Additional_Information/ws:User_Name_Of_Manager/text(),1,1,.....)"/>

谢谢你的支持!

4

1 回答 1

1

好吧,您可以查看的一种方法是:

<xsl:value-of select="substring(input, 1, 1)"/>
<xsl:value-of select="substring-after(input, '.')"/>

在 XSLT 2.0 中,您可以使用正则表达式:

<xsl:value-of select="replace(input, '^(.).*?\.(.*?)$', '$1$2')"/>
于 2021-10-21T07:29:19.563 回答