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

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
xsl import xml
Hi,
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
people.
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:

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





The xsl that comes with it looks like this:

<?xml version="1.0"?>
<xsl:stylesheet>
<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"/>
   <p/><br/>
<table width="610" align="center" border="0">
 <tr valign="top">

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

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

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

 </tr></table>
<p/><br/>
   <xsl:call-template name="pagebottom"/>
</body></html>
</xsl:template>

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


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

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:apply-templates/>
      </xsl:template>
  </xsl:template>

 <xsl:template name="left_nav">

    <table width="100%" bgcolor="#c7a086" cellpadding="0" cellspacing="0">
     <tr><td width="100%">
       SubNavigatie
     </td></tr>
     <tr><td bgcolor="#0000ff">
         <xsl:apply-templates/>
      </td></tr></table>
  </xsl:template>
</xsl:stylesheet>

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:

<resource>
    <test>this is a test</test>

    <ref>
      <title>Go toYahoo!</title>
    </ref>
    <ref>
      <title>Go to Altavista</title>
    </ref>
    <ref>
      <title>Go to Track</title>
    </ref>
    <ref>
      <title>Go to Zoek.nl</title>
    </ref>
    <ref>
      <title>Go to Astalavista</title>
    </ref>
  </resource>

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

Greetings,

Cyril Moerkoert


 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.