Re: [xsl] generating an HTML web hierarchy from XML using XSLT

Subject: Re: [xsl] generating an HTML web hierarchy from XML using XSLT
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Jan 2002 16:44:27 -0500
At 2002-01-22 16:24 -0500, Saverio Perugini wrote:
Is XSLT capable of transforming an XML file modeling [only] the schema of a
web site into to an actual HTML web hierarchy?

Through vendor extensions, yes, but not in the language as defined by W3C.


If possible, I surmise that this task entails using XSLT to perfrom a
depth-first search of the XML input graph and creating a new HTML file
(and adding an <a href> to it for each child) every time a child
is encountered.

That is not correct ... one creates each page in sequence determining all links as required by revisiting the source node tree.


Is XSLT capable of creating multiple output files and manipulating and
switching between them while processing? which this task seems to
require.

Looking at the problem that way will not succeed, you are obligated to produce each result tree in result parse order, thus requiring you to revisit the source tree as many times as required to do all of your links.


A working example is illustrated on pages 110 through 113 of the free download preview of our electronic book "Practical Transformation Using XSLT and XPath" ... downloading the free preview does not obligate you to buy a copy of the book (though buying a copy does grant you perpetual no-charge access to all future editions of the book, including any future rewrites for XPath 2.0 and XSLT 2.0 and beyond; site and world licenses are also available).

That example that is freely available shows a single XML file representing two HTML files and how the XT extension function is used to create two HTML results with interlinked URLs between them.

I hope this helps.

......................... Ken


-- Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO - Feb 18-22, 2002

G. Ken Holman                mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6                        Definitive XSLT & XPath
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1               Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training:  02-02-11,12,14,15,18,21,03-04,05,06,08,11,
-                                04-08,09,10,12,05-14,15,06-04,07


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread