Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The variables you are declaring will not be in scope for your output_person template. In order for this to work, you need to have the output_person template accept params and then pass those params as part of <a href="http://www.w3.org/TR/xslt#named-templates" rel="nofollow">call-template</a>. </p> <p>Also note that references to variables shouldn't be enclosed in quotes.</p> <p>For example:</p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;!-- other templates --&gt; &lt;xsl:template match="your-element"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="xref"&gt; &lt;xsl:variable name="TAG_ID" select="xref/@linkend" /&gt; &lt;xsl:variable name="NAME" select="//*[@id=$TAG_ID]/para[@id='who']" /&gt; &lt;xsl:variable name="EMAIL" select="//*[@id=$TAG_ID]/para[@id='who']/ulink/@url" /&gt; &lt;xsl:variable name="IMAGE" select="//*[@id=$TAG_ID]/para[@id='image']" /&gt; &lt;xsl:variable name="MEET" select="//*[@id=$TAG_ID]/para[@id='meet']" /&gt; &lt;xsl:call-template name="output_person"&gt; &lt;xsl:with-param name="NAME" select="$NAME"/&gt; &lt;xsl:with-param name="EMAIL" select="$EMAIL"/&gt; &lt;xsl:with-param name="IMAGE" select="$IMAGE"/&gt; &lt;xsl:with-param name="MEET" select="$MEET"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:variable name="NAME" select="para[@id ='who']" /&gt; &lt;xsl:variable name="EMAIL" select="para[@id='who']/ulink/@url" /&gt; &lt;xsl:variable name="IMAGE" select="para [@id='image']" /&gt; &lt;xsl:variable name="MEET" select="para [@id='meet']" /&gt; &lt;xsl:call-template name="output_person"&gt; &lt;xsl:with-param name="NAME" select="$NAME"/&gt; &lt;xsl:with-param name="EMAIL" select="$EMAIL"/&gt; &lt;xsl:with-param name="IMAGE" select="$IMAGE"/&gt; &lt;xsl:with-param name="MEET" select="$MEET"/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:template&gt; &lt;xsl:template name="output_person"&gt; &lt;xsl:param name="NAME"/&gt; &lt;xsl:param name="EMAIL"/&gt; &lt;xsl:param name="IMAGE"/&gt; &lt;xsl:param name="MEET"/&gt; &lt;!-- your logic here --&gt; &lt;/xsl:template&gt; </code></pre> <p></p>
 

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