[Home] [By Thread] [By Date] [Recent Entries]
Hi Matthieu,
Maybe I am missing something obvious, but on a quick review of your problem I notice three things: 1. You use an xsl:for-each on a simple selected node set. This is usually best replaced (refactored) with a xsl:template match. 2. You use a complex variable for every situation (but you figured out yourself that this is not the best way, which is why you posted the q. in the first place). 3. The snippet you showed does not produce the output you showed on the input you showed. This is how I would do it: <!-- this goes on the root level of the stylesheet --> <xsl:template match="row"> <entry one="{(entry[1]/para[. != ''] | preceding-sibling::row[entry[1]/para != ''][1])[1]}" two="{(entry[2]/para[. != ''] | preceding-sibling::row[entry[2]/para != ''][1])[1]}" /> </xsl:template> <!-- this goes on wherever you currently have for-each --> <xsl:apply-templates select="row" /> If you want something like one/two/three etc for each entry that is available, I'd choose another solution, something along the following lines: <xsl:template match="entry">
<xs:attribute name="{format-number(position(), '[Nn]')}" select="." />
</not sure whether the format is correct though. HTH, Cheers, -- Abel Braaksma Mathieu Malaterre wrote: Hello,
|

Cart



