Subject:XSL Template problem Author:Atif Sarfraz Date:26 Nov 2001 08:45 PM
Hi,
I have created an XSL template to automatically check a radio button depending upon some value of XML. So if there is a group of 5 radio buttons, then depending upon the value of XML field, one of them would be checked.
The template works fine with one group of radio buttons. But if I start calling the same template from another group, with a different "name", then the first group and the second group of radio buttons behave as they belonged to the same group.
At least in the Stylus Studio processor, trying to re-define the value of
an attribute already defined in the parent element is a no-op (I searched
the specs trying to understand what the right behavior should be, but I
couldn't find this case covered...).
That means that the name of the radio buttons would end-up being always the
same (empty) explaining the behavior you are describing.
If that's the problem, the fix is very easy: just remove 'name=""' from
your {input} element creation.
>...
>What I feel is that arg2 behaves like a sort of a global variable, and on
>changing the group of radio buttons, the first one also gets effected.
>
>Am I correct? Is there a way out of it? Or should I create separate
>templates for each group of radio buttons.
No, template parameters are not global variables; you should expect the
named template to be called with a different set of parameter values every
time it's called.
Subject:XSL Template problem Author:Atif Sarfraz Date:27 Nov 2001 10:01 AM
Hi,
I have checked the code again, and even if I remove the name attribute from the top element, the code still doesn't work. It only works only if I remove all the name attributes including the new ones.