This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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@fcg.com

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]