Trouble Including XSL Files in another XSL File

Subject: Trouble Including XSL Files in another XSL File
From: Corina McCleary <CorinaM@xxxxxxxx>
Date: Tue, 19 Sep 2000 12:50:17 -0700
I am trying to include an XSL file in another XSL file with no luck.  I know
this topic has been on the list before and I tried to use the example that
Steve Muench posted, but that does not seem to be working for me.  I am
calling a COM object which returns an XML string then using an ASP page to
load my XSL page.  I am not getting any errors or any output from my
included XSL file.  I was using xmlns:xsl="http://www.w3.org/TR/WD-xsl";, but
I was getting the following errors:
	Keyword xsl:output may not be used here. and Keyword xsl:include may
not be used here. 
So I switched to use xmlns:xsl="http://www.w3.org/1999/XSL/Transform";.
Does anyone know what I am doing wrong?

Here is my Test2.asp file:

<%@ LANGUAGE="VBScript" %> 
<%
 Option Explicit
 'On Error Resume Next
Response.Buffer = false
Response.Expires=0
Response.cachecontrol="private" 
Dim strXML, oXMLDoc, strStyleSheet, piStyleSheet, oTempNode 
strXML =
"<DOCUMENT><DATA><SESSION><NAV><SCREEN><SCREENNUMBER>1</SCREENNUMBER><SCREEN
NAME>Initial
Instructions</SCREENNAME></SCREEN><SCREEN><SCREENNUMBER>2</SCREENNUMBER><SCR
EENNAME>User
Profile</SCREENNAME></SCREEN></NAV><SESSIONID>2</SESSIONID><DESTINATIONNAME>
User
Profile</DESTINATIONNAME><LOGIN>MickeyMouse</LOGIN><APPCODE>MLS-IPO</APPCODE
><CURRENTSCREENNUMBER>2</CURRENTSCREENNUMBER><TOTALSCREENS>2</TOTALSCREENS><
DESTINATIONURL>test2</DESTINATIONURL></SESSION></DATA></DOCUMENT>"

Set oXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
oXMLDoc.async = False 
oXMLDoc.loadXML(strXML) 
If (oXMLDoc.parseError.errorCode <> 0) Then
	Response.Write "XML PARSE ERROR: " & oXMLDoc.parseError.reason
Else 
	strStyleSheet = "Test2.xsl"
	'If mstrBrowser = "XML" Then 'IE5+ or NS6+
		Response.ContentType = "text/xml" 
		Set piStyleSheet =
oXMLDoc.createProcessingInstruction("xml:stylesheet","type=""text/xsl""
href=""" & strStyleSheet & """") 
		Set oTempNode = oXMLDoc.insertBefore(piStyleSheet,
oXMLDoc.documentElement) 
		Response.Write(oXMLDoc.xml) 
		Set oTempNode = Nothing 
		Set piStyleSheet = Nothing 
End If 
Set oXMLDoc = Nothing 
%> 

Here is my Test2.xsl file:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0" >
<xsl:output method="html" indent="yes"/>
<xsl:include href="header.xsl"/>
<xsl:template match="/">
<HTML>
<HEAD>
  <TITLE>Master Business Application</TITLE>
  <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; charset=iso-8859-1"/>
  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE" />
  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PRIVATE" />
  <META HTTP-EQUIV="Expires" CONTENT="-1" />
</HEAD>
<BODY>
	<xsl:apply-templates />
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

Here is my header.xsl file to be included:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version
"1.0" >
<xsl:template name='header'>
<xsl:for-each select='DOCUMENT/DATA/SESSION'>
  <TABLE VALIGN='MIDDLE' BORDER='0' WIDTH='100%' CELLSPACING='0'
CELLPADDING='0'> 
    <TR ALIGN='CENTER'>
      <TD BACKGROUND='images/bg.gif' VALIGN='MIDDLE' ALIGN='RIGHT'
WIDTH='80px' ROWSPAN='2'>
        <IMG SRC='images/seal.gif' WIDTH='45px' HEIGHT='46px'/>
      </TD>
      <TD VALIGN='MIDDLE' ALIGN='LEFT' COLSPAN='3' BGCOLOR='#00008c'>
        &#160;&#160;&#160;&#160;&#160;
	     <FONT SIZE='4' COLOR='#FFFFFF'><B>Master Business
Application</B></FONT> 
	   </TD>
    </TR>
    <TR>
      <TD VALIGN='MIDDLE' ALIGN='LEFT' BGCOLOR='#c6c6c6' WIDTH='25%'>
	     &#160;&#160;&#160;&#160;&#160;
	     <FONT COLOR='#00008c' SIZE='2'>
		   Step&#160;<B><xsl:value-of select='CURRENTSCREENNUMBER'
/></B>
		   &#160;of&#160;<B><xsl:value-of select='TOTALSCREENS'
/></B>&#160;&#160;&#160;
	     </FONT>
      </TD>
      <TD VALIGN='MIDDLE' ALIGN='LEFT' BGCOLOR='#94B6CE'>
	     <IMG SRC='images/divider.jpg' ALIGN='ABSBOTTOM' WIDTH='13px'
HEIGHT='24px' />
      </TD>
      <TD VALIGN='MIDDLE' ALIGN='RIGHT' BGCOLOR='#94B6CE' WIDTH='70%'>
	     <FONT COLOR='#00008c' SIZE='2'><B>Move to</B>
          <SELECT VALIGN='MIDDLE' NAME='cboScreen' ONCHANGE='postPage();'>
		    <xsl:for-each select='NAV/SCREEN'>
			  <OPTION>
                <xsl:if test="SCREENNUMBER[.$eq$ //CURRENTSCREENNUMBER]">
                  <xsl:attribute name='SELECTED' />
                </xsl:if>
			    <xsl:attribute name='VALUE'><xsl:value-of
select='SCREENNUMBER' /></xsl:attribute>
			    <xsl:value-of select='SCREENNAME' />
			   </OPTION>
			 </xsl:for-each>
	       </SELECT>
	     </FONT>
      </TD>
    </TR>
    <TR>
      <TD VALIGN='MIDDLE' ALIGN='CENTER' COLSPAN='4' BGCOLOR='#00008c'>
	     <FONT SIZE='3' COLOR='#FFFFFF'><B><U><xsl:value-of
select='DESTINATIONNAME' /></U></B></FONT>
      </TD>
    </TR>
  </TABLE>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Corina McCleary
LOGICAL
CorinaM@xxxxxxxx
DOL Phone:(360) 586-1589


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


Current Thread