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

Limitations of Includes in XSL

Subject: Limitations of Includes in XSL
From: Ken Burnside <Ken.Burnside@xxxxxxxxxxxxxxxxxx>
Date: Tue, 25 Apr 2000 13:52:15 -0500
stylist studio xml
My thanks in advance for your time.  This is lengthy -- if you don't want
to deal with xsl:include, feel free to move on to the next message now.

I'm currently the XSL stylist at the State of Wisconsin Circuit Court
Automation Project, and our project involves using XSL stylesheets to
transform data extracted from a database in XML into formatted objects,
which are then transformed into the final output the user requested (Paper,
HTML, PDF)

We have a lot of very common stylistic blocks that we use, as many of the
forms we're replicating pull common elements -- lists of charges, attorney
names, plaintiff names -- that are all pulled by queries from the database.

What I've been trying to do is a trick I've used as a web developer -- the 
metaphorical equivilant of server side includes in the XSL file. Rather
than cut and paste a filing and disposition control table like this

(Warning -- long code block that probably doesn't have enough space for its
indents...)

=====

<!-- This table handles the filing and disposition information. -->
<fo:table>
	<!-- Five Columns.  Rows determined by "next action" loop. -->
	<!-- Define columns widths here.  No rows or spans yet. -->
	<fo:table-column column-width="1.75in"/>
	<fo:table-column column-width="1.75in"/>
	<fo:table-column column-width="1.75in"/>
	<fo:table-column column-width="1.5in"/>
	<fo:table-column column-width="1.25in"/>
	<fo:table-body font-size="9pt" font-family="sans-serif" color="black">
		<!-- 1st Row Starts Here. -->
		<fo:table-row line-height="10pt" font-weight="bold">
		<!-- 1st Column Starts Here. -->
	        <fo:table-cell>
			<fo:block>Filing Date/C.O.</fo:block>
		</fo:table-cell>
		<!-- 2nd Column Starts Here. -->
		<fo:table-cell>
			<fo:block>Disposition Date/C.O.</fo:block>
		</fo:table-cell>
		<!-- 3rd Column Starts Here. -->
		<fo:table-cell>
		<fo:block>District Attorney</fo:block>
		</fo:table-cell>								
	</fo:table-row>
	<!-- Second Row Starts Here -->
	<fo:table-row>
		<!-- 1st Column Starts Here.  Filing date, and court officer. -->
		<fo:table-cell>
		   	<fo:block>
<xsl:value-of select="/TR-300/FilingDispoRPQ/filingDate"/>
			</fo:block>
			<fo:block>
			<fo:inline-sequence>
<xsl:value-of select="/TR-300/FilingDispoRPQ/filingNameF"/>
			<fo:inline-sequence color="white">.</fo:inline-sequence> 
			</fo:block>						</fo:table-cell>
	</fo:table-row>								
</fo:table-body>
</fo:table>

from XSL file to XSL file.  Obviously, much was elided from the sample
above, but the table is easily 60 lines of code, that's replicated through
90% of what I'm working on.

I'd prefer to put it as a separate file, and call it as such:

<xsl:include href="filingAndDispo.xsl">

I'm running into two problems:

1) The XML parser (FOP) says that I cannot use an include inside of a
template.  I'm trying to see if I can summon the include outside the
template and call the results from within it, but I confess to floundering
a lot.

2) The other issue I'm running into is passing the appropriate root
document to the XSL widget that's called by the include.  For example:  The
whole form processes TR-300.xml.  The widget processes the ChargeListRSQ
block of code, and the attributes of the tags inside of it.  Since the
widget needs to look for the ChargeListRSQ block in any XML file, it can't
reference TR-300.xml directly. Since the include cannot be inside of the
<xsl:template> element, the obvious path of inheritance doesn't work.  Is
there any other way to specify "Look at this document" in the XSL file,
while, in turn, having the generic widget not care what the document is
(getting it from the statement above), and look for the attributes
referenced in the included file.

Has anyone succeeded in doing this?


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.