title: Why are the XSL functions `ends-with` and `matches` both throwing an error?
body: <p><br /><br />
  I am transforming some XML, renaming each element named <code>alt-title</code> to <code>Running_Head</code>, provided that the attribute <code>alt-title-type</code> is equal to "running-head".
  <br /><br /><hr />
  So, the below code is using the line <code>&lt;xsl:when test="starts-with(@alt-title-type, 'running-head')"&gt;</code> which is working fine. However, when I change this to either of these:</p>
  
  <ul>
  <li><code>&lt;xsl:when test="ends-with(@alt-title-type, 'running-head')"&gt;</code></li>
  <li><code>&lt;xsl:when test="matches(@alt-title-type, 'running-head')"&gt;</code></li>
  </ul>
  
  <p>...this error is thrown:
  <br /></p>
  
  <blockquote>
    <p>Error:XSLTProcessor::transformToXml() [xsltprocessor.transformtoxml]:
    xmlXPathCompiledEval: 2 objects left on the stack.</p>
  </blockquote>
  
  <p>So, it seems that the function <code>starts-with</code> is working, where <code>ends-with</code> and <code>matches</code> are not.
  <br /><br /><hr />
  Here is my XSL, using <code>starts-with</code>, that seems to be working properly:
  <br /><br /></p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:output encoding="UTF-8" indent="yes" method="xml" /&gt;
  
      &lt;!-- Running_Head --&gt;
      &lt;xsl:template match="@*|node()"&gt;
          &lt;xsl:choose&gt;
  
              &lt;xsl:when test="starts-with(@alt-title-type, 'running-head')"&gt;
                  &lt;xsl:element name="Running_Head"&gt;
                      &lt;xsl:apply-templates select="@*|node()"/&gt;
                  &lt;/xsl:element&gt;
              &lt;/xsl:when&gt;
  
              &lt;xsl:otherwise&gt;
                  &lt;xsl:copy&gt;
                      &lt;xsl:apply-templates select="@*|node()"/&gt;
                  &lt;/xsl:copy&gt;
              &lt;/xsl:otherwise&gt;
  
          &lt;/xsl:choose&gt;
      &lt;/xsl:template&gt; &lt;!-- end of Running_Head --&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>...and here is the XML being transformed:
  <br /></p>
  
  <pre><code>&lt;root-node&gt;
      &lt;alt-title alt-title-type="running-head"&gt;
          This is working
      &lt;/alt-title&gt;
      &lt;alt-title alt-title-type="asdfng-head"&gt;
          asdfasdf
      &lt;/alt-title&gt;
      &lt;alt-title&gt;
          asdfasdf
      &lt;/alt-title&gt;
      &lt;alt-title alt-title-type="running-head"&gt;
          This is also working
      &lt;/alt-title&gt;
  &lt;/root-node&gt;
  </code></pre>
  
  <p><br />
  I am testing this at <a href="http://xslt.online-toolz.com/tools/xslt-transformation.php" rel="nofollow">http://xslt.online-toolz.com/tools/xslt-transformation.php</a>, and <a href="http://www.xsltcake.com/" rel="nofollow">http://www.xsltcake.com/</a>.</p>