<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(() => {
  const xmlSource = '<poke/>';
  const xslSource = `<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exsl="http://exslt.org/common">

    <xsl:variable name="peek" select="exsl:node-set('')"/>

    <xsl:template match="poke">
      <xsl:text>PASS</xsl:text>
    </xsl:template>
  </xsl:stylesheet>`;

  const parser = new DOMParser();
  const xsl = parser.parseFromString(xslSource, 'text/xml');
  const xml = parser.parseFromString(xmlSource, 'text/xml');

  const xslproc = new XSLTProcessor();
  xslproc.importStylesheet(xsl);
  const result = xslproc.transformToFragment(xml, document);
  assert_equals(result.firstChild.textContent, 'PASS');
}, 'a variable set to node-set of a string should not halt processing');
</script>
