I'm trying to script a simple wrapper of the MS DOM for xslt processing.

This script chokes on the transformation:

require 'win32ole'

dom = WIN32OLE.new('MSXML2.DOMDocument')
dom.async = false
if !dom.load('sample.xml')
  Exception.exception('loading of sample.xml failed.')
end

xsl = WIN32OLE.new('MSXML2.DOMDocument')
xsl.async = false
if !xsl.load('sample.xsl')
  Exception.exception('loading of sample.xsl failed.')
end

newXML = dom.transformNode(xsl)
# Above line produces following error:
# The stylesheet does not contain a document element.  The stylesheet may be
# empty, or it may not be a well-formed XML document.

For reference, here's the xml and xsl, which does work through the same OLE
code written in Delphi:

<?xml version="1.0"?>
<Sample>
  <Child PropA="A" PropB="B" />
</Sample>

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
  <xsl:element name="Sample">
    <xsl:for-each select="Sample/Child">
      <xsl:element name="Child">
        <xsl:element name="PropA">
          <xsl:value-of select="@PropA"/>
        </xsl:element>

        <xsl:element name="PropB">
          <xsl:value-of select="@PropB"/>
        </xsl:element>
      </xsl:element>
    </xsl:for-each>
  </xsl:element>
</xsl:template>
</xsl:stylesheet>

Output should be:

<?xml version="1.0" encoding="UTF-16"?>
<Sample>
  <Child>
    <PropA>A</PropA>
    <PropB>B</PropB>
  </Child>
</Sample>