IDM - using an XPath counter

Using an XPath counter is not really that difficult, but due to the way dirxml script was implemented, one have to split the whole thing in two rules.

First setup a rule which initializes the variable which is used for the counter:

<do-set-local-variable name="lv_counter" scope="driver">
<token-xpath expression="number(0)"/>

Notice the scope is set to driver, otherwise it will be local to the rule.

Then a rule which is using the counter:

<token-text xml:space="preserve">//input/*</token-text>
<do-set-local-variable name="lv_counter" scope="driver">
<token-xpath expression="number($lv_counter) + 1"/>

Then for each loop in the do-for-each loop it will count one up.


Popular posts from this blog

Kviknet and IPv6

Apple IOS cannot download song

Apple AirPort Express and Digital Jitter..