[Home] [By Thread] [By Date] [Recent Entries]
Hi Brett
"Looping through a recordset" is not something XSLT can do, as that implies that you can instruct XSLT to perform a loop, which you can't (notwithstanding the xsl:for-each, which is not a loop instruction, it selects a node-set and processes them, not necessarily in any order). Your sample code is unparsable and I am not certain what to make of it. It helps to have a tiny working XML and XSLT sample that we can run to see exactly what you mean and help you get the output correct. Of what I do understand of your code is that you use xsl:for-each in a way that it is not necessary (but not wrong either) to use it, but before you know it, you end up with lot's of nested for-each instructions which won't help the clarity and maintainability of your code. Instead, use matching templates and apply-templates where you now use xsl:for-each: <!-- place this at your current for-each --> <xsl:apply-templates select="RACE_LIST_HORSES/HORSE" /> <!-- place this somewhere in the root level of your stylesheet --> <xsl:template match="HORSE"> <section startonnewpage="false" .... etc ... </xsl:template> Now, to answer your question: right where you want this exception. You do not need an xsl:if instruction. Just use apply-templates again. Where you currently would place the xsl:if, place the following instruction: <xsl:apply-templates select="HORSE_FRONT_ROW_FLAG[. = '2' and preceding-sibling::HORSE/HORSE_FRON_ROW_FLAG[. = '1']" /> <!-- and place this somewhere at the root level again --> <xsl:template match="HORSE_FRONT_ROW_FLAG"> your text here that otherwise would be in the if-instruction </xsl:template> If you find that the template is called to often because of other instructions that trigger it, you can give both the xsl:apply-templates and the xsl:template a mode of your choice (make sure they are the same). HTH, Cheers, -- Abel Braaksma Brett Luntz wrote: Hi,
|

Cart



