[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Discovering the joys of xsl:include

Subject: Discovering the joys of xsl:include
From: Lukas Svoboda <LukasS@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Apr 2001 15:51:59 +1200
lukas svoboda
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.