I'm using Oxygen 8.1 and Saxon 8.
I am trying to mine information from a table.
In some cases the cell with the target data is straddled between two or more rows.
So, if I look into the row and the target is not there, I need to look in the row above. If the target is not there, then go up one more. Repeat until the target is found.
I am trying to implement this as a recursive template:
Code:
<xsl:template match="row" mode="row-proc">
<xsl:choose>
<xsl:when test=".//TL1Attribute">
<xsl:value-of select=".//TL1Attribute"></xsl:value-of>
<xsl:text>#x0A;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="preceding-sibling::node()[last()]" mode="row-proc"></xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
My reasoning for select="preceding-sibling::node()[last()] is process a selection of the sibling nodes (table rows), going directly to the last() one (should be the row right before the current row???) and recurse into the template.
If the target isn't found then get a new preceding sibling list, get a new last() node and recurse again.
Obviously this isn't working, but I'm not sure why.
It nearly works, except instead of going back one row, it goes all the way back to the first row.
So, what is the best way to process a preceding-sibling list in reverse document order?
Thanks,
- mike
------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876
Michael Hare