XML/XSL output to multiple HTML files

Discussion in 'XML' started by Froefel, Nov 19, 2007.

  1. Froefel

    Froefel Guest

    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
     
    Froefel, Nov 19, 2007
    #1
    1. Advertising

  2. Froefel

    Pavel Lepin Guest

    Froefel <> wrote in
    <>:
    > 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.
     
    Pavel Lepin, Nov 19, 2007
    #2
    1. Advertising

  3. Froefel

    Wizfrog Guest

    Wizfrog, Nov 22, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray Tayek
    Replies:
    3
    Views:
    537
    Ray Tayek
    Nov 30, 2003
  2. Richard R.
    Replies:
    1
    Views:
    636
    Martin Honnen
    Nov 8, 2004
  3. Replies:
    1
    Views:
    3,690
    A. Bolmarcich
    May 27, 2005
  4. bouton
    Replies:
    0
    Views:
    423
    bouton
    Sep 22, 2005
  5. Replies:
    4
    Views:
    999
    M.E.Farmer
    Feb 13, 2005
Loading...

Share This Page