Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just replace your </p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" version="1.0"&gt; </code></pre> <p>with </p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:ext="http://exslt.org/common" exclude-result-prefixes="ext msxsl" version="1.0"&gt; </code></pre> <p>and <code>msxsl:node-set</code> with <code>ext:node-set</code> to make it work.</p> <p>complete xslt is as follows:</p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:ext="http://exslt.org/common" exclude-result-prefixes="ext msxsl" version="1.0"&gt; &lt;xsl:output method="html" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" indent="yes"/&gt; &lt;xsl:variable name="main" select="/data"/&gt; &lt;xsl:template name="myTemplate"&gt; &lt;xsl:param name="myparam"/&gt; &lt;xsl:param name="node"/&gt; Node: &lt;xsl:value-of select="$node"/&gt;&lt;br/&gt; Inner:&lt;xsl:choose&gt; &lt;xsl:when test="contains($node,'foo/')"&gt;&lt;xsl:value-of select="ext:node-set($myparam)/data/foo/*[local-name() = substring-after($node,'/')][1]" /&gt;&lt;/xsl:when&gt; &lt;xsl:otherwise&gt;&lt;xsl:value-of select="ext:node-set($myparam)/data/*[local-name() = $node][1]" /&gt;&lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:template&gt; &lt;xsl:template match="/data"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; HTML STARTS &lt;br/&gt; &lt;xsl:variable name="data" select="."/&gt; Outer1:&lt;xsl:value-of select="$data"/&gt; &lt;br/&gt; Outer2:&lt;xsl:value-of select="$data/foobar"/&gt; &lt;br/&gt; &lt;xsl:variable name="defaultMetadata" select="document('metadata.xml')"/&gt; &lt;xsl:for-each select="ext:node-set($defaultMetadata)/Metadata/Data/Detail"&gt; &lt;br/&gt;----&lt;br/&gt; &lt;xsl:call-template name="myTemplate"&gt; &lt;xsl:with-param name="node"&gt;&lt;xsl:value-of select="."/&gt;&lt;/xsl:with-param&gt; &lt;xsl:with-param name="myparam"&gt;&lt;xsl:copy-of select="$data"/&gt;&lt;/xsl:with-param&gt; &lt;/xsl:call-template&gt; &lt;/xsl:for-each&gt; &lt;/html&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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