Skip to main content

XSLT examples

Here is an example of XSLT identity transformation that transforms a document to itself (which means, no transformation is performed):

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

Here is an example of template which changes a message value to another value:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>
 
   <xsl:template match="LastName/text()[.='Icebear']">Panda</xsl:template> 
 
</xsl:stylesheet>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!