views:

23

answers:

1

I have an XSL code that processes some nodes and if some condition is true, before doing apply-template select="." i need to modify current node(add and attribute).

How can i add an attribute to the node before calling apply-template select=".", or it is not possible at all ?

A: 

You can have two transformations applied -- the first copies every node as is, but only adds the necessary attribute to the node in question. Then the second transformation is applied on the result of the first transformation.

Another way is to leave the addition of the attribute to the templates that are applied with <xsl:apply-templates select="."/>

Dimitre Novatchev