At 2004-10-26 16:23 +1300, Fraser Crichton wrote:
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
"all kinds of conditional stuff"??
Unless I'm missing something, just do:
<xsl:if test="qcr:ExemptionRow">
<table ...>
...
<tbody>
<xsl:apply-templates select="qcr:ExemptionRow"/>
</tbody>
</table>
</xsl:if>
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.
Walking through it all I suppose that would work, but it would be a bear to
maintain ... think of the long-term consequences and having other people
who need to maintain your code.
What I'm interested in is what could go wrong with this solution,
Someone trying to support it later would have problems.
is it an appropriate XSL style
I think not ... I would judge it quite inappropriate when a simpler and
more easily maintainable solution can be found.
and what performance implications could it have?
I suspect your way is slower than the above way ... but not by much ... I'm
more concerned about understanding and working with the code.
I hope you find this helpful.
....................... Ken
--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal