Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>In case you don't want to edit the imported stylesheet code, the way to remove the namespace is with a two-pass transformation (which in XSLT 1.0 requires using an <code>xxx:node-set()</code> extension function):</strong></p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ext="http://exslt.org/common" exclude-result-prefixes="ext" &gt; &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:variable name="vrtfPass1"&gt; &lt;xsl:call-template name="SomeTemplate"&gt; &lt;xsl:with-param name="Element" select="'randomParam'"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:variable&gt; &lt;xsl:variable name="vPass1" select="ext:node-set($vrtfPass1)"/&gt; &lt;xsl:apply-templates select="$vrtfPass1/node()" mode="pass2"/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="*" mode="pass2"&gt; &lt;xsl:element name="{name()}"&gt; &lt;xsl:copy-of select="@*"/&gt; &lt;xsl:apply-templates mode="pass2"/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template name="SomeTemplate" xmlns="http://www.google.com"&gt; &lt;xsl:param name="Element"/&gt; &lt;Blabla&gt; &lt;xsl:value-of select="$Element" /&gt; &lt;/Blabla&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p><strong>When this transformation is applied on any XML document (not used), the wanted result (the default namespace removed) is produced</strong>:</p> <pre><code>&lt;Blabla&gt;randomParam&lt;/Blabla&gt; </code></pre> <p><strong>Update</strong>:</p> <p>The OP has indicated in a comment that he is using Xalan 2.07.</p> <p>Below is almost the same solution, but with namespace and name for the <code>xxx:node-set()</code> function, as used in Xalan:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="x" &gt; &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:variable name="vrtfPass1"&gt; &lt;xsl:call-template name="SomeTemplate"&gt; &lt;xsl:with-param name="Element" select="'randomParam'"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:variable&gt; &lt;xsl:variable name="vPass1" select="x:nodeset($vrtfPass1)"/&gt; &lt;xsl:apply-templates select="$vrtfPass1/node()" mode="pass2"/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="*" mode="pass2"&gt; &lt;xsl:element name="{name()}"&gt; &lt;xsl:copy-of select="@*"/&gt; &lt;xsl:apply-templates mode="pass2"/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template name="SomeTemplate" xmlns="http://www.google.com"&gt; &lt;xsl:param name="Element"/&gt; &lt;Blabla&gt; &lt;xsl:value-of select="$Element" /&gt; &lt;/Blabla&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload