tags:

views:

176

answers:

3

I have an XML file that I am creating an XSL stylesheet for.

What I would like is to have two frames and do two passes on the data, the first would create a Table of Contents in the left frame, and the second would have the body of data in the right.

I can do the two passes, the problem is putting them in separate frames. The frame HTML element takes in a source; I can't put my source directly in there.

I can think of a few ways to get around this, none of which I'm thrilled with, so I wanted to see if anyone had found a way to do this.

A: 

If you want to use frames you need three separate files.

  1. The frame file. This is just a strict HTML file
  2. A file for your table of contents
  3. A file for your content

The first one is as specified just an HTML file. The second two are XSL files that will eventually turn into HTML. A good tutorial on frames is here at W3Schools.

EDIT: The more I think about this, the more I dislike the solution. It requires the XSL parser to be run twice for each time the initial page is served

Have you thought about using CSS or tables to do your layout? There are some really good open source CSS templates flying about here on the interwebs.

Matt Campbell
A: 

This was relatively stable data that would be generated by a script, so what I ended up doing was creating separate stylesheets for the TOC and the main window, then using those to generate html files for each of them after I generate the html.

Then my main page was just a static html page that referenced these generated html files.

There's probably a better way to do it, but this is an internal reference, so this is enough to get me going.

JohnMcG
A: 

As said before, you need 3 files for this.

In XSLT 2.0 you can generate multiple output files from one xsl stylesheet using the xsl:result-document instruction.

In XSLT 1.0 you don't have that function, but depending on the processor it might be possible. For example for Xalan see http://xml.apache.org/xalan-j/extensions_xsltc.html#redirect_ext

deathy