RE: [xsl] CONTEST: How to implement "templates"? ;-)

Subject: RE: [xsl] CONTEST: How to implement "templates"? ;-)
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 9 Sep 2002 09:36:34 +0100
> Here is a contest for those with too much time (you can
> only win the honor to be the one who came up with the
> best solution ;-):
> 
> How can one implement "templates" with XSLT?
> 
> Explanation:
> 
> I have a XML file data.xml which contains lots of useful info:
> 
>     <root>
> 	<info id="info1">
> 	    <title>This is the title of info1</title>
> 	    ...
> 	</info>
> 	<info id="info2">
> 	    ...
> 	</info>
> 	...
>     </root>
> 
> Then I have a file layout.xml which descibes the layout of the
> result:
> 
>     <layout>
>     <html>
>     <head>
> 	<title><put-title-here/></title>
>     </head>
>     <body>
> 	...
>     </body>
>     </html>
>     </layout>
> 
> And now the task: Write an XSLT script which creates one
> HTML page for every /root/info element in data.xml and
> uses the layout from layout.xml. Or to put it a different
> way: How can I control how the XSLT processor processes one 
> file from another XML file?
> 
The best solution to this, in my view, is to write a stylesheet that
converts layout.xml into an XSLT stylesheet, and then applies that
stylesheet to data.xml.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx  


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


Current Thread