Thanks Wendel
I ended up factorizing them. Managed to move a lot of global variables into
helper templates that get included first
Regards
Mark
-----Original Message-----
From: xsl-list-digest-help(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:xsl-list-digest-help(_at_)lists(_dot_)mulberrytech(_dot_)com]
Sent: Saturday, August 13, 2011 12:10 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: xsl-list Digest 13 Aug 2011 05:10:01 -0000 Issue 2596
xsl-list Digest 13 Aug 2011 05:10:01 -0000 Issue 2596
Topics (messages 59783 through 59786):
Re: XSLT 2.0 Quine
59783 by: Wendell Piez
Combining XSL's
59784 by: Mark Anderson
59785 by: Wendell Piez
Re: transforming MRSS
59786 by: Dirk
Administrivia:
To subscribe to the digest, e-mail:
<xsl-list-digest-subscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
To unsubscribe from the digest, e-mail:
<xsl-list-digest-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
To post to the list, e-mail:
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
----------------------------------------------------------------------
Date: Fri, 12 Aug 2011 16:21:49 -0400
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com>
Subject: Re: [xsl] XSLT 2.0 Quine
Message-ID: <4E458B5D(_dot_)9000008(_at_)mulberrytech(_dot_)com>
Chris,
Actually it shouldn't work in a 1.0 engine, at least one that doesn't take
liberties with the rule forbidding the processing of result tree fragments.
Which processor did you try? (Have you tried another?)
That's not to disparage it; I concur it's ingenious. Just to say that beyond
this hill there's another one to climb.
Cheers,
Wendell
On 8/11/2011 10:47 PM, Chris Maloney wrote:
You are a crazy genius, and this is a thing of beauty!
I can verify that it works -- amazing!
Just a note, it works as a version 1.0 stylesheet too (as long as you
change "2.0" to "1.0" everywhere, of course ;-)
--
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================
------------------------------
Date: Fri, 12 Aug 2011 22:01:05 +0000
To: "xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com"
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: Mark Anderson <mark(_dot_)anderson(_at_)technique-mis(_dot_)com>
Subject: Combining XSL's
Message-ID:
<9A212579241F3D448847B190307A34770D2E18D1(_at_)EXCHANGE(_dot_)technique(_dot_)co(_dot_)uk>
Hi All
I'm trying to take a very large XSL with multiple sections and split it int= o
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=20
Header
Sect1
Sect2
Footer
Others Want to see
Header
Sect4
Footer
Etc.
Essentially each section is a fragment of HTML with xsl processing instruct=
ions.
Sect 4, for example, may be raw materials:
<table>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <xsl:for-each select=3D"mater=
ial">
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 <tr>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <td><xsl-v=
alue-of select=3D"name"/></td>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 </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 rea=
lity, each section relies on variables setup elsewhere in doc, and has to g= et
data from many different locations.
I could make umpteen copies and easily cut out the bits I don't want, but t=
hen 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 bit= s
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> ta= gs
and footer needs to have the </body> and </html> tags so neither the hea= der
of footer could be valid xml, xsl, etc. (I know I could use > and di= sable
output escaping)
Is there any way to do this?
Regards
mark
------------------------------
Date: Fri, 12 Aug 2011 19:31:25 -0400
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com>
Subject: Re: [xsl] Combining XSL's
Message-ID: <4E45B7CD(_dot_)9070502(_at_)mulberrytech(_dot_)com>
Mark,
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.
Or a stylesheet that processes a driver XML, which you or your users modify to
configure what outputs appear where. (This is most flexible and versatile,
maybe too much so.)
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.
Please don't consider using disable-output-escaping for that: it's neither
necessary nor wise! The way you "split the open and close tags"
here (which is a poor way of conceptualizing what is happening) is to emit the
entire html, head and body elements from the correct template(s), then apply
templates from inside them. (See?)
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
On 8/12/2011 6:01 PM, Mark Anderson wrote:
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or
e-mail:<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================
------------------------------
Date: Sat, 13 Aug 2011 04:37:54 +0200
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Dirk <noisyb(_at_)gmx(_dot_)net>
CC: Lighton Phiri <lighton(_dot_)phiri(_at_)gmail(_dot_)com>
Subject: Re: [xsl] transforming MRSS
Message-ID: <4E45E382(_dot_)6000804(_at_)gmx(_dot_)net>
parsing multiple namespaces in xml works fine now... i don't know what i did
different this time..
awesome.. :)
Dirk
------------------------------
End of xsl-list Digest
***********************************
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--