RE: CONTEST: How to implement "templates"? ;-)
> 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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format