Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML/XSL output to multiple HTML files

Reply
Thread Tools

XML/XSL output to multiple HTML files

 
 
Froefel
Guest
Posts: n/a
 
      11-19-2007
I've manually prototyped a mechanism that generates multiple HTML
files from a single XML file, using an XSL template. However, now I
need to automate this mechanism (simple .NET console app).
Being a newby at XML/XSL I'm facing one caveat, namely that each HTML
file is not just the result of a subset of the XML data.
The data is a list of computers, each with lots of details (see
simplified version below).
What I'm after is an HTML file for each computer, with a sort of Table
of Content that lists all the computers.
The TOC will be the same for each HTML file.
So in order to build the TOC, I need to look at the entire XML tree
(top nodes at computer level), whereas for the content of a computer I
need to look at one node at a time.

Example:
<?xml version="1.0" encoding="UTF-8" ?>
<station name="PC1">
<naming>
<computername>PC1</computername>
</naming>
<hardware>
<platform>PC</platform>
<rammb>1152</rammb>
</hardware>
</station>
<station name="PC2">
<naming>
<computername>PC2</computername>
</naming>
<hardware>
<platform>Mac</platform>
<rammb>4245</rammb>
</hardware>
</station>
<station name="PC3">
<naming>
<computername>PC3</computername>
</naming>
<hardware>
<platform>PC</platform>
<rammb>2048</rammb>
</hardware>
</station>


This XML file should be transformed into 3 HTML files, which would
look as follows:
<div>
<a href="PC1.html">PC1</a>
<a href="PC2.html">PC1</a>
<a href="PC3.html">PC1</a>
</div>
<div>
... computer details go here
</div>

The XSL can contain a <xsl:for-each select="a:station"> loop to build
the TOC. But how do I go about outputting one HTML file per station
node?

I have a fully functional prototype of XML+XSL = HTML where all
computers are within a single HTML. I could email the files if it
helps clarify the issue.
Any help would be greatly appreciated?

-- Hans
 
Reply With Quote
 
 
 
 
Pavel Lepin
Guest
Posts: n/a
 
      11-19-2007

Froefel <> wrote in
<194f5d40-79e0-4e59-959c->:
> I've manually prototyped a mechanism that generates
> multiple HTML files from a single XML file, using an XSL
> template.
>
> This XML file should be transformed into 3 HTML files...
>
> The XSL can contain a <xsl:for-each select="a:station">
> loop to build the TOC. But how do I go about outputting
> one HTML file per station node?
>
> I have a fully functional prototype of XML+XSL = HTML
> where all computers are within a single HTML.


Impossible with plain old XSLT1. Possible with XSLT2 (see
xsl:result-document) or EXSLT (exsl:document). See the
documentation for your processor to determine whether it
supports either of those.

--
....also, I submit that we all must honourably commit seppuku
right now rather than serve the Dark Side by producing the
HTML 5 spec.
 
Reply With Quote
 
 
 
 
Wizfrog
Guest
Posts: n/a
 
      11-22-2007

I would suggest you check this solution out:

http://www.perfectxml.com/articles/x...MSXML.asp?pg=2

That's probably the goal you want to achieve, with very little effort.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Breaking up single HTML file into multiple HTML files Kevin HTML 1 04-15-2007 10:11 PM
output to console and to multiple files nathan.shair@gmail.com Python 14 02-17-2007 12:52 AM
input and output from multiple text files malla C++ 9 08-09-2006 02:43 PM
Re: output from multiple files Alan Connor Perl 0 04-28-2005 09:56 AM
Text files read multiple files into single file, and then recreate the multiple files googlinggoogler@hotmail.com Python 4 02-13-2005 05:44 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57