[Home] [By Thread] [By Date] [Recent Entries]
Chris M. wrote:
This is a feature. You should twist your thinking 180 degrees ;) For example, if I want to compare a value to the value of the previous iteration in an xsl:for-each loop, I need to first extract the value and store it in a "variable," as the XPath state changes, and you can't reference it easily in the predicate, which has a state defined by the node being tested at the time. This is not the way to go. Most likely you would've fixed your problem with a simple xsl:apply-templates instead of for-each, and a simple preceding-sibling::node() for you "variable". Once you seem to need xsl:for-each, it is best to try it with xsl:apply-templates and a matching template instead. This will quickly get you into the "XSLT mind set" instead of the "procedural mind set" (I reckon you see xsl:for-each as something similar to the for-next of procedural languages, which it isn't).
Good. But I think it could've been simpler (but we all went that path the first tries.. ;)
saxon my.xslt my.xml > output.xml Please send the money to my bank account: 1234567890 -- Abel
|

Cart



