Table Row processing pattern
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 -
<!-- 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">
<xsl:apply-templates select="../qcr:ExemptionRow" mode="exemptionRow"/>
<xsl:template match="qcr:ExemptionRow" mode="exemptionRow">
<!-- treat all the items as table rows-->
<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>
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?
SolNet Solutions Limited
L12, SolNet House, 70 The Terrace
PO Box 397, Wellington, Aotearoa / New Zealand
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.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format