/*initialize a variable*/
<?xdoxslt:set_variable($_XDOCTX, ‘counter’, 0)?> or
<?xdoxslt:set_variable($_XDOCTX,‘test‘,“wibble")?>
/*get a variable*/
<?xdoxslt:get_variable($_XDOCTX,
‘test’)?>
/*update the variable’s value by adding the current value to
MY_CNT, which is XML element */
<?xdoxslt:set_variable($_XDOCTX, ‘counter’,
xdoxslt:get_variable($_XDOCTX, ‘counter’) + MY_CNT)?>
/* accessing the variables */
<?xdoxslt:get_variable($_XDOCTX, ‘counter’)?>
/*Working in a loop*/
<?xdoxslt:set_variable($_XDOCTX, ‘counter’, 0)?>
<?for-each:G1?>
/*increment the counter*/
<?xdoxslt:set_variable($_XDOCTX, ‘counter’,
xdoxslt:get_variable($_XDOCTX, ‘counter’) + 1)?>
<?end for-each?>
<?xdoxslt:get_variable($_XDOCTX, ‘counter’)?>
No comments:
Post a Comment