Hi,
I use XSLT for a lot of time, but mostly of time I use it wrongly because I am basically a programmer and then I have this habit of think proceduraly.
Anyway, recently I learn this nice way of make tests within a for-each loop:
Code:
<xsl:variable name="AlphaExact">
<xsl:for-each select="//root/Inventory/InventoryRow[control = 1][1]">
<xsl:value-of select="substring(InventoryNumber,10,1)" />
</xsl:for-each>
</xsl:variable>
In this case, it sets my variable 'AlphaExact' with a proper vaue when the 'control' field in a row matches the value 1.
OK, It works fine for me but I really don't know exactly what the [1] does.
Is this the number of times that my test should match then if I replace it with [2] it should have at least two rows matching 1 before to load the var 'AlphaExact' with the given value?