To perform it more clear and dynamic with changes and requirements I suggest to use as in XSL below:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="get_value_from_str">
<xsl:param name="in.str"/>
<xsl:param name="in.val"/>
<xsl:param name="in.sep"/>
<xsl:choose>
<xsl:when test="string-length($in.val) >0 and string-length($in.sep) >0">
<xsl:value-of select="substring-before(substring-after(normalize-space($in.str), concat($in.val, '=')), $in.sep)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space($in.str)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:attribute-set name="mail-session-attr">
<xsl:attribute name="jndi-name">
<xsl:call-template name="get_value_from_str">
<xsl:with-param name="in.str" select="'java:jboss/mail/mailservice'" />
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:call-template name="get_value_from_str">
<xsl:with-param name="in.str" select="/mail-session/name" />
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="debug">
<xsl:call-template name="get_value_from_str">
<xsl:with-param name="in.str" select="/mail-session/properties" />
<xsl:with-param name="in.val" select="'mail.debug'" />
<xsl:with-param name="in.sep" select="';'" />
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="from">
<xsl:call-template name="get_value_from_str">
<xsl:with-param name="in.str" select="/mail-session/properties" />
<xsl:with-param name="in.val" select="'mail.from'" />
<xsl:with-param name="in.sep" select="';'" />
</xsl:call-template>
</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="smtp-server-attr">
<xsl:attribute name="outbound-socket-binding-ref" select="''"/>
<xsl:attribute name="tls" select="''"/>
<xsl:attribute name="ssl" select="''"/>
</xsl:attribute-set>
<xsl:attribute-set name="login-attr">
<xsl:attribute name="name">
<xsl:call-template name="get_value_from_str">
<xsl:with-param name="in.str" select="/mail-session/properties" />
<xsl:with-param name="in.val" select="'mail.smtp.user'" />
<xsl:with-param name="in.sep" select="';'" />
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="password" select="''"/>
</xsl:attribute-set>
<xsl:template match="/">
<xsl:element name="mail-session" use-attribute-sets="mail-session-attr">
<xsl:element name="smtp-server" use-attribute-sets="smtp-server-attr">
<xsl:element name="login" use-attribute-sets="login-attr"/>
</xsl:element>
</xsl:element>
<xsl:element name="subsystem" />
</xsl:template>
</xsl:stylesheet>
Then result will be as expected above:
<?xml version="1.0" encoding="UTF-8"?>
<mail-session jndi-name="java:jboss/mail/mailservice" name="MailSession-1" debug="false" from="[email protected]">
<smtp-server outbound-socket-binding-ref="" tls="" ssl="">
<login name="weblogic" password=""/>
</smtp-server>
</mail-session>
<subsystem/>
Hope it will be useful for you.