XML/XSL output to multiple HTML files

F

Froefel

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
 
P

Pavel Lepin

Froefel said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top