Subject: Re: [xsl] Combining XSL's From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 12 Aug 2011 19:31:25 -0400 |
Goodness, there are lots of ways to do this; but it's going to be tricky as long as everything is a big pull.
For example (only one obvious way I can think of) a set of stylesheets calling the same modules can each process the nodes in a different order, calling the same set of templates to do so only changing the order of their calls.
Or one stylesheet, with a parameterized conditional to determine which order is used.
Your HTML infrastructure (the 'head' element, 'body' element and so forth) can be generated by a single template in a module that is always used.
Instead, start by refactoring your code into templates, and then see if that by itself doesn't give you some ideas. (Or pick a method I've suggested and ask again.)
Cheers, Wendell
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> and disable output escaping)
Is there any way to do this?
Regards
mark
-- ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Combining XSL's, Mark Anderson | Thread | [xsl] Combining XSL's, Mark Anderson |
[xsl] Combining XSL's, Mark Anderson | Date | Re: [xsl] transforming MRSS, Dirk |
Month |