This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Discovering the joys of xsl:include
- To: "'XSL-List at lists dot mulberrytech dot com'" <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] Discovering the joys of xsl:include
- From: Lukas Svoboda <LukasS at AdvantageGroup dot co dot nz>
- Date: Tue, 24 Apr 2001 15:51:59 +1200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi, just trying to get xsl:includes working, but keep getting "Keyword
xsl:import may not be used here" Using MSXML3 btw.
My XML is:
<?xml version="1.0"?>
<page_data>
<header>
<company_name>Company XYZ</company_name>
<copyright>(C) Company XYZ, Blah Blah</copyright>
</header>
<products>
<product>
<product_id>1</product_id>
<product_title>Product Title 1</product_title>
<product_description>This is the description of the product
123456</product_description>
</product>
<product>
<product_id>2</product_id>
<product_title>Product Title 2</product_title>
<product_description>This is the description of the product
435322</product_description>
</product>
</page_data>
My Main XSL is:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:template match="/">
<xsl:import href="header.xsl" />
<table border="1" cellpading="4" cellspacing="4" bordercolor="#ffffff"
bgcolor="#BBBBBB">
<xsl:apply-templates select="page_data/products/product" />
</table>
</xsl:template>
<xsl:template match="product">
<html>
<body>
<tr>
<xsl:apply-templates select="product_id" />
<xsl:apply-templates select="product_title" />
<xsl:apply-templates select="product_description" />
</tr>
</body>
</html>
</xsl:template>
<xsl:template match="product_id">
<td><b><font face="verdana" color="#000033" size="2"><xsl:value-of
select="../product_id"/></font></b></td>
</xsl:template>
<xsl:template match="product_title">
<td><b><font face="verdana" color="#000033" size="2"><xsl:value-of
select="../product_title"/></font></b></td>
</xsl:template>
<xsl:template match="product_description">
<td><b><font face="verdana" color="#000033" size="2"><xsl:value-of
select="../product_description"/></font></b></td>
</xsl:template>
</xsl:stylesheet>
My Include XSL is:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:template match="/">
<xsl:apply-templates select="page_data/header" />
</xsl:template>
<xsl:template match="header">
<font face="verdana" color="#000033" size="3"><xsl:value-of
select="company_name"/></font><br>
<font face="verdana" color="#000033" size="1"><xsl:value-of
select="copyright"/></font><br>
</xsl:template>
</xsl:stylesheet>
What am I doing wrong? Take the include out and it works fine.
Thanks in advance,
Lukas
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list