[xsl] embedded xslt with xsl:include crashes IE6 browser

Subject: [xsl] embedded xslt with xsl:include crashes IE6 browser
From: "Joe Meree" <jmeree1@xxxxxxxxxxx>
Date: Sat, 01 Mar 2003 21:46:28 -0500
Vendor: Microsoft
Vendor URL: http://www.microsoft.com

I am having a problem trying to embed an xsl:stylesheet in an XML data island and then use transformnode to render the page.

The problem seems to be with the xsl:include statement. If I put the stylesheet into a separate file and use <XML ... src="file.xstl" > instead, it works. If I embed the xsl:stylesheet in the <XML> tag on the html page, the browser (IE6) crashes when I launch the page from the local file system. If I use a relative url for the xsl:include, the browser says "The system cannot locate the object specified". If I use an absolute url (like the example below), the browser crashes when I launch the html file. I've also tried launching the html file from tomcat using both relative and absolute urls for the included xslt file. If I comment out the xsl:include and put the TestFrame template directly into the embedded stylesheet, it works. I really need to use xsl:include because my application is much bigger than this test sample.

I've seen posts that talk about using a fully-qualified URL on the xsl:include. I haven't been able to get it working using file://..., but even if it worked, this seems to defeat the purpose of having reusable, modular xslt files. I could understand that href's inside an html page might need to be fully qualified, but I have several layers of nesting of xsl:imports and I think it?s unreasonable to fully-qualify every href. I hope I?m doing something wrong.

I am attaching the html file that contains the main stylesheet and the included xslt file below.
I appreciate any help.
Joe Meree
Scitor Corporation


*** this is the contents of the file testInclude2a.htm
<html>
<head>
	<title>Frame</title>
	<SCRIPT type="text/javascript">
		function myTransform()
		{  myTarget.innerHTML = myFrame.transformNode(myStyle.XMLDocument);  }
	</SCRIPT>

</head>
	<body onload="myTransform()" >
		<DIV id="myTarget"> </DIV>
	</body>
</html>

<XML id="myFrame" >
	<TestFrame id="1" title="Got to TestFrame template">
	</TestFrame>
</XML>

<!-- XML id="myStyle" src="testInclude2a.xslt" -->
<XML id="myStyle" >
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0" xmlns:data="DataFrame.dtd" exclude-result-prefixes="data">
<data:DataFrame id="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<data:DataContent id="3"/>
<data:Environment>
<data:EnvItem name="item1" value="item1Value"/>
<data:EnvItem name="item2" value="item2Value"/>
</data:Environment>
</data:DataFrame>
<xsl:include href="E:\mydocs\testInclude2b.xslt"/>
<xsl:variable name="dataRoot" select="document('')/xsl:stylesheet/data:DataFrame/data:Environment"/>
<xsl:template match="/">
dataRoot/item2/name=<xsl:value-of select="$dataRoot/data:EnvItem[2]/@name"/><br/>
<xsl:apply-templates select="TestFrame" />
</xsl:template>
</xsl:stylesheet>
</XML>


*** The following text is in the file testInclude2b.xslt which is in the same directory as testInclude2a.htm
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0" xmlns:data="DataFrame.dtd" >
<xsl:template match="TestFrame">
<xsl:param name="data"/>
Frame title:<xsl:value-of select="@title"/><br/>
dataRoot/item1/value=<xsl:value-of select="$dataRoot/data:EnvItem[1]/@value"/><br/>
</xsl:template>
</xsl:stylesheet>









_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



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



Current Thread