How to import XML data into an imported XSLT sheet?

Subject: How to import XML data into an imported XSLT sheet?
From: "Vulcane Design" <cyril@xxxxxxxxx>
Date: Sat, 18 Mar 2000 12:52:16 +0100
I'm working for a week to get this done, but nothing seems to work. I hope
someone of you can help me here.

This is what I'm trying to do:

I'm working on a layout that will have a top-navigatiion block, a bottom
navigtion block and in between 3 colums, containing the  "left navigation,
main content en a right navigation,
This last 3 colums should be bild in a table.
The top - and bottom navigation will be placed in the xsl stylesheet.

The table will also be placed in the same xsl stylesheet.

I want the content for left-, right navigation and the main content to be
imported for a xml file, because that content will be easy to edit by
And I don't want them to edit the stylesheet.
The problem is, that I can't get this data. I think, the path to this data
in this xml file is wrong.
(Please don't worry about the xml namespace [ <?xml version="1.0"?> ], it
works fine with the program I'm using)

Well, the index.xml (source) lokks lijke this:

   <content file="left.xml"/>
   <content file="main.xml"/>
   <content file="right.xml"/>

The xsl that comes with it looks like this:

<?xml version="1.0"?>
<xsl:import href="left_nav.xsl"/>
<xsl:import href="main_win.xsl"/>
<xsl:import href="right_nav.xsl"/>
<xsl:template match="/">
  <html><body bgcolor="#fff7d7" text="#000000" link="#000099"
vlink="#2b3856" alink="#ff0000">
   <xsl:call-template name="pageheader"/>
<table width="610" align="center" border="0">
 <tr valign="top">

  <td width="150">
   <xsl:call-template name="left_nav"/>

  <td width="300">
   <xsl:call-template name="main_win"/>

  <td width="150">
   <xsl:call-template name="right_nav"/>

   <xsl:call-template name="pagebottom"/>

<!-- page header -->
<xsl:template name="pageheader">
    <table width="600" border="0" cellspacing="0" align="center">
    <tr><td width="200">
      Here goed the text
      <td width="400" align="right">
         Here goed some more text

  <!-- page bottom -->
  <xsl:template name="pagebottom">
    Well, this look almost the same as the pageheader does. Don't worry
about it.

So, I import 3 stylesheets, left-nav, main-win and right-nav.

Hope your're still with me, getting close to the problem.

Let's stick to the left-nav xsl file.

It looks like this, (removed the fancy stuff)

<?xml version="1.0"?>
  <xsl:output method="html"/>

  <xsl:template match="/">
      <xsl:template select="document('left.xml',@file)//resource/test">

 <xsl:template name="left_nav">

    <table width="100%" bgcolor="#c7a086" cellpadding="0" cellspacing="0">
     <tr><td width="100%">
     <tr><td bgcolor="#0000ff">

Well, putting text in this table will work, but I think something is wrong
in the path to the left.xsl file.

This file looks like this:

    <test>this is a test</test>

      <title>Go toYahoo!</title>
      <title>Go to Altavista</title>
      <title>Go to Track</title>
      <title>Go to</title>
      <title>Go to Astalavista</title>

Well, hope somebody can help me here. I'm getting crazy...


Cyril Moerkoert

 XSL-List info and archive:

Current Thread