[xsl] Combining XSL's

Subject: [xsl] Combining XSL's
From: Mark Anderson <mark.anderson@xxxxxxxxxxxxxxxxx>
Date: Fri, 12 Aug 2011 22:01:05 +0000
Hi All

I'm trying to take a very large XSL with multiple sections and split it into
several smaller xsl's that can be combined in any order. Its transforming XML
to HTML for job ticket. Because of the nature of the doc it uses pull
processing: basically and HTML page with lots of xsl:value-of, etc.

The full XSL has

   Header
   Sect 1
   Sect 2
   Sect 3
   Sect 4
   Footer

Some user want to see
   Header
   Sect1
   Sect2
   Footer

Others Want to see
   Header
   Sect4
   Footer

Etc.

Essentially each section is a fragment of HTML with xsl processing
instructions.

Sect 4, for example, may be raw materials:

<table>
                <xsl:for-each select="material">
                                <tr>
                                                <td><xsl-value-of
select="name"/></td>
                                </tr>
</table>

That's a really over-simplified example, as that could easily be done
apply-templates and a match on materials, which could easily be included. In
reality, each section relies on variables setup elsewhere in doc, and has to
get data from many different locations.


I could make umpteen copies and easily cut out the bits I don't want, but then
if the header changes I need to edit umpteen XSL's

What I really want to do is have "shell" XSL that combines the relevant bits

Include header
Include sect 1
Include Sect 4
Include footer

The big problem I see is that the header will have the <html> and <body> tags
and footer needs to have the </body> and </html> tags so neither the header of
footer could be valid xml, xsl, etc. (I know I could use &gt; and disable
output escaping)

Is there any way to do this?

Regards

mark

Current Thread