Hi
My aim is using XSLT 1.0 that can be rendered into XHTML 1.0 by a modern browser such as Firefox 3.5.
In order to keep the XSLT stylesheets simple I thought I could do a simple run with a stylesheet acting as a decorator for the input document before passing it on to the stylesheet that should render the XHTML. This is to add certain details that are unrelated to the rendering itself.
Scenario:
- The document (say Document.xml) has a <?xml-stylesheet[..] processing instruction pointing to DecorateDocument.xsl.
- DecorateDocument.xsl runs through Document.xml copying what needs to stay the same and appending details (decorating) here and there.
- It also matches the processing instruction and writes a new stylesheet URL into the output document, like so:
Code:
<xsl:template match="processing-instruction('xml-stylesheet')">
<xsl:processing-instruction name="xml-stylesheet">
<xsl:text>href="RenderXHTML.xsl" type="text/xsl"</xsl:text>
</xsl:processing-instruction>
</xsl:template>
- The output document now has the RenderXHTML.xsl stylesheet as its target stylesheet.
The question: Can this ever work? How do I tell the browser/other parser to rerun the result document with the new stylesheet to render the XHTML?
I really hope it can be done as it seems like an elegant way of simplifying the different tasks that XSLT need to do.