[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Combining XSL's

Subject: Combining XSL's
From: Mark Anderson <mark.anderson@xxxxxxxxxxxxxxxxx>
Date: Sat, 13 Aug 2011 20:07:01 +0000
 Combining XSL's
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@xxxxxxxxxxxxxxxxxxxxxx
[mailto:xsl-list-digest-help@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Saturday, August 13, 2011 12:10 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxx>

To unsubscribe from the digest, e-mail:
	<xsl-list-digest-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>

To post to the list, e-mail:
	<xsl-list@xxxxxxxxxxxxxxxxxxxxxx>


----------------------------------------------------------------------
Date: Fri, 12 Aug 2011 16:21:49 -0400
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Subject: Re:  XSLT 2.0 Quine
Message-ID: <4E458B5D.9000008@xxxxxxxxxxxxxxxx>

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@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
======================================================================

------------------------------

Date: Fri, 12 Aug 2011 22:01:05 +0000
To: "xsl-list@xxxxxxxxxxxxxxxxxxxxxx" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: Mark Anderson <mark.anderson@xxxxxxxxxxxxxxxxx>
Subject: Combining XSL's
Message-ID:
<9A212579241F3D448847B190307A34770D2E18D1@xxxxxxxxxxxxxxxxxxxxxxxx>

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 &gt; 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@xxxxxxxxxxxxxxxxxxxxxx
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Subject: Re:  Combining XSL's
Message-ID: <4E45B7CD.9070502@xxxxxxxxxxxxxxxx>

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&gt; 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
======================================================================

------------------------------

Date: Sat, 13 Aug 2011 04:37:54 +0200
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: Dirk <noisyb@xxxxxxx>
CC: Lighton Phiri <lighton.phiri@xxxxxxxxx>
Subject: Re:  transforming MRSS
Message-ID: <4E45E382.6000804@xxxxxxx>

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
***********************************

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.