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
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