Created
October 15, 2019 23:37
-
-
Save TurekBot/869fce5e7624cdc40cd9e737261feb32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<!-- This template will return the Message, changing the email address to the one provided. --> | |
<xsl:output method="xml" omit-xml-declaration="yes"/> | |
<!-- Here we set up a parameter that will be passed in. --> | |
<xsl:param name="emailReplacement"/> | |
<!-- This block copies the whole thing (the input) into the output. --> | |
<xsl:template match="node() | @*"> | |
<xsl:copy> | |
<xsl:apply-templates select="node() | @*"/> | |
</xsl:copy> | |
</xsl:template> | |
<!-- This block replaces the `email_addr` atribute of the Email element with the given email. --> | |
<xsl:template match="/Message/Email/@email_addr"> | |
<!-- The name attribute is required, so we just specify the same name as before. `name()` uses the same name the attribute had previously—we don't want to change the attribute name, just its value. --> | |
<xsl:attribute name="{name()}"> | |
<xsl:value-of select="$emailReplacement"/> | |
</xsl:attribute> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment