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

Table Row processing pattern

Subject: Table Row processing pattern
From: Fraser Crichton <fraser.crichton@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Oct 2004 16:23:36 +1300
row processing
Hi,

I've an issue with Optional elements treated as tables rows in XHTML and XSL-FO.

I need to make sure an element actually exists in a document (sometimes it will sometimes it won't) before processing it as the row of a table (the table should only be there if the elements exist) otherwise I get XHTML / FO validation errors to do with empty table bodies.

Rather than stick markup around the apply-templates (and get the validation errors) or all kinds of conditional stuff in the template I presume (??) that an effective way of dealing with the problem is to nest the markup in the first match on the elements I want to make into table rows and then "reprocess" that row and all subsequent rows. My templates generally follow this pattern -

<xsl:template match="qcr:ExemptionRow[1]">
<!-- match on the first element and generate a table header before applying a moded apply-templates to all the rows in the table -->
<table border="0" width="100%" cellpadding="2" cellspacing="4">
<thead>
<tr>
<th width="30%">LHS</th>
<th width="30%">RHS</th>
<th width="40%">Exclusion</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="../qcr:ExemptionRow" mode="exemptionRow"/>
</tbody>
</table>
</xsl:template>


<xsl:template match="qcr:ExemptionRow" mode="exemptionRow">
<!-- treat all the items as table rows-->
<tr>
<td><xsl:apply-templates select="qcr:LhsExemptionItems"/><br /></td>
<td><xsl:apply-templates select="qcr:RhsExemptionItems"/><br /></td>
<td><xsl:apply-templates select="qcr:ExclusionExemptionItems"/><br /></td>
</tr>
</xsl:template>


What I'm interested in is what could go wrong with this solution, is it an appropriate XSL style and what performance implications could it have?

Cheers,

Fraser


--
Fraser Crichton
Web Developer
SolNet Solutions Limited
L12, SolNet House, 70 The Terrace
PO Box 397, Wellington, Aotearoa / New Zealand
www.solnetsolutions.co.nz <http://www.solnetsolutions.co.nz>
DDI: 04-462-5078
Mob: 027-278-3392
Fax: 04-462-5011
email: fraser.crichton@xxxxxxxxxxxxxxxxxxxxx <mailto:fraser.crichton@xxxxxxxxxxxxxxxxxxxxx>


Attention:
This email may contain information intended for the sole use of
the original recipient. Please respect this when sharing or
disclosing this email's contents with any third party. If you
believe you have received this email in error, please delete it
and notify the sender or postmaster@xxxxxxxxxxxxxxxxxxxxx as
soon as possible. The content of this email does not necessarily
reflect the views of SolNet Solutions Ltd.

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.