[xsl] XSLT processor adds unwanted HTML attributes

Subject: [xsl] XSLT processor adds unwanted HTML attributes
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx (by way of Mulberry Technologies List Owner)
Date: Sun, 16 Feb 2003 12:52:01 -0800
From: Graham Hannington <Ghannington@xxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: XSLT processor adds unwanted HTML attributes
Date: Sun, 16 Feb 2003 13:22:48 -0000

I'm splitting a single, large XML (well, XHTML) file into multiple files,
breaking at the <h1> elements.

I'm using the following stylesheet:

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

<xsl:preserve-space elements="*" />

<xsl:output method="xml" />

 <xsl:template match="h1">
  <xsl:variable name="file_name" select="concat(., '.htm')" />
  <xsl:message>Splitting <xsl:copy-of select="$file_name" />
  <xsl:document href="{$file_name}" >
	<link rel="StyleSheet" href="style/default.css" />
	<script src="style/default.vbs" language="VBScript"></script>
   <xsl:copy-of select="." />
	<xsl:call-template name="followingElements"/>

	<xsl:template name="followingElements">
			<xsl:copy-of select="." />
			<xsl:call-template name="followingElements"/>


(I wish I knew a better way to have line breaks than to code all that &#x0A
stuff.  Maybe call a named template each time instead, I guess.  Stuart
Brown: you'll probably recognize some of your code in that followingElements
template... thanks again :-)

Here's the problem (with apologies, I realize this dips into XSLT
processor-specific behaviour):

- MSXSL (the command-line interface to MSXML) appears to not support the
<xsl:document> element.

- Saxon works fine, but - here's the annoying bit - adds colspan and rowspan
attributes to my <td> tags (even though I'm specifying XML as the output
method). I interpret Saxon as doing something "naughty" here, or am I wrong?

How do I stop these well-meaning additions?  (To - hopefully - avoid flames
for discussing processor-specific implementation issues: I don't know for
sure that this is a Saxon-specific thing... it could be that XSLT processors
in general are allowed to do this stuff unless they're told otherwise; I
just don't know how to tell them otherwise ;-)

Graham Hannington

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

Current Thread