I have a large XSLT stylesheet that converts an XML format into HTML. I would like to add support for XInclude in the input XML file. The goal is that each include file can be XSD-validated independently, as well as the including XML file. I have all the changes in the XML schema for that under control (I think); there are only specific XML elements that can be moved out to include files, and there will be only one level of include file nesting. I have that working in the XML editor of Eclipse, it nicely validates both the including file and each include file.
The XSLT stylesheet is used in two ways, and here we get closer to my question:
In a build environment by a Python script that uses lxml for the XSLT transformation. The Python script is integrated into a make-based build environment and into an Ant script for Eclipse.
In an xsl-stylesheet instruction in the including XML file. This is for the case where people want to immediately see the changes they do in any of the XML files, in a Web browser. This has proven to be a very effective environment, so far, so I don't want to loose that.
I was able to get use case 1. working by using the ElementTree.xinclude() method in the Python script. However, that is no solution for use case 2.
Also, I do understand how to write an XSLT stylesheet that performs only the Xinclude resolution, and this could in theory be used as a first transformation, followed by the existing XSLT stylesheet for the XML to HTML conversion. The problem is that the XML file can have only one xsl-stylesheet instruction.
Another idea would be to leave the XInclude resolution to the Web browser. However, I am not aware of any Web browser that supports that. Also, I would hate to have the restriction to use just one particular browser. So far, we support all of the most common browsers.
Another idea would be to add XInclude resolution support into the existing XSLT stylesheet. However, there I am struggling with what is input and what is output, because these are really three stages (XML input as in the files -> FLat XML with Xinclude resolved -> HTML. The XInclude resolving part would need to perform the first transformation and the existing XSLT code would perform the second. I'm not sure that is possible in one stylesheet.
My questions are:
Is there any way how I can get two XSLT stylesheets invoked when opening the (including) XML file with a Web browser ?
Is there any way how I can improve the existing XSLT stylesheet with XInclude support so that it remains a single stylesheet ?
Is there any way in an XSLT stylesheet to modify the input ?
Do Web browsers provide any support in XInclude resolution ?
Thanks Andy