Subject:Generate an XSLT from an XML file for subsequent use on other XML Author:Gregory McKenzie Date:10 Oct 2007 11:55 AM
We are looking at taking an XML definition of a data table, generating an Excel XSLT from the XML definition of the data table. The generated Excel XSLT is then to be used on serialised data that is stored in the data table.
XML Definition of Data Table
Provided below is a cut down version of an XML definition of a table.
Generating an Excel XSLT from XML
The Excel XSLT that we want to create takes the XML definition of the table and generates an XLST output that can then be used on XML data to output an Excel XML document. An example of the a cut down version of the Excel XSLT we are *trying to generate* is provided below.
The XML above is transformed into an XML Excel document.
(A) Creating the XSLT that generates the Excel XSLT from the XML definition of the data table. The problems are outputting tags such as '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">'.
Have identified some useful commands along the was such as:
Subject:Generate an XSLT from an XML file for subsequent use on other XML Author:Alberto Massari Date:10 Oct 2007 12:30 PM
what you are trying to do is called "meta stylesheet", where an XSLT stylesheet has as output another XSLT stylesheet. The trick to make it work is to generate the XSLT keywords in a different namespace (like out:stylesheet, with "out" assigned to the "xxxxx" namespace URI), and then have a xsl:namespace-alias instruction to convert it to the real one.
See http://www.xml.com/pub/a/2003/11/05/xslt.html for a nuce tutorial on this technique.