Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are two problems with your XSL.</p> <p>Firstly, where you copy the gm element, you have not correctly closed off the gm tag.</p> <pre><code>&lt;gm&gt;&lt;xsl:value-of select="gm"/&gt;&lt;gm&gt; </code></pre> <p>This should become</p> <pre><code>&lt;gm&gt;&lt;xsl:value-of select="gm"/&gt;&lt;/gm&gt; </code></pre> <p>Secondly, althuogh you are copying the Shift elements, your resultant XML does not contain a root element. You need to put a Rota element outside your xsl:apply-templates call</p> <pre><code>&lt;xsl:template match="/"&gt; &lt;Rota&gt; &lt;xsl:apply-templates select="$strXPath"&gt; &lt;xsl:sort select="substring(date,7,4)"/&gt; &lt;!-- year sort --&gt; &lt;xsl:sort select="substring(date,4,2)"/&gt; &lt;!-- month sort --&gt; &lt;xsl:sort select="substring(date,1,2)"/&gt; &lt;!-- day sort --&gt; &lt;/xsl:apply-templates&gt; &lt;/Rota&gt; &lt;/xsl:template&gt; </code></pre> <p>Note that you can simplify the copying of the Shift element, simply by doing this</p> <pre><code>&lt;xsl:template match="Shift"&gt; &lt;xsl:copy-of select="." /&gt; &lt;/xsl:template&gt; </code></pre> <p>There is also a problem with the ASP code. The line <strong>newxml.load(xml.transformNode(xsl))</strong> is incorrect. Because transformNode returns a string containing the XML, you really need to do the following</p> <pre><code>newxml.loadXml(xml.transformNode(xsl)) </code></pre> <p>Use <strong>load</strong> when loading xml from a file. Use <strong>loadXml</strong> when loading a string containing Xml</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