Skip to content

Instantly share code, notes, and snippets.

@yamanyar
Created December 3, 2013 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamanyar/7768788 to your computer and use it in GitHub Desktop.
Save yamanyar/7768788 to your computer and use it in GitHub Desktop.
Adds Soap header if it is missing
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*[not(//soapenv:Header)]">
<xsl:copy>
<soapenv:Header />
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<!--
Add empty soap header if it is missing.
Kaan Yamanyar
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment