[xsl] Evaluating a node-set with select (MSXSL vs. Saxon)

Subject: [xsl] Evaluating a node-set with select (MSXSL vs. Saxon)
From: "Dyck, Stan" <sdyck@xxxxxxx>
Date: Thu, 18 Apr 2002 13:27:30 -0700
Greetings,

I'm having a problem getting the MSXML (4.0) parser to do a transform for
me. Given the following stylesheet...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

	<xsl:variable name="columns">
		<xsl:element name="columns">
			<xsl:element name="column">Name</xsl:element>
			<xsl:element name="column">Name 2</xsl:element>
			<xsl:element name="column">DOB</xsl:element>
			<xsl:element name="column">Gender</xsl:element>
		</xsl:element>
	</xsl:variable>

<!-- Main root template -->
	<xsl:template match="root">
		
		<html><body>
		<h3>Person List</h3>
			<table border="1" width="100%">
				<!-- MSXSL doesn't like this -->
				<xsl:apply-templates select="$columns"/>
			</table>
		</body></html>

	</xsl:template>
	
	<xsl:template match="columns">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="column">
		<th>
			<xsl:apply-templates/>
		</th>
	</xsl:template>
	
</xsl:stylesheet>

...against any old xml file with <root> as the root element, like...

<?xml version="1.0" encoding="UTF-8"?>
<root>
	<a></a>
	<b></b>
</root>

...I would expect the following html:

<html>
   <body>
      <h3>Person List</h3>
      <table border="1" width="100%">
         <th>Name</th>
         <th>Name 2</th>
         <th>DOB</th>
         <th>Gender</th>
      </table>
   </body>
</html>

I do indeed get this using the Saxon (6.5.1), but MSXSL (4.0) tells me that
the $columns variable must evaluate to a node-set and fails to compile the
stylesheet. Can anyone tell me which XSLT engine is doing the right thing
here? I'm using the MSXSL command line utility against version 4.0 of MSXML.

Thanks,
Stan Dyck
sdyck@xxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread