[Dojo-interest] dojo.xml.XslTransform removing IE stylesheet parameters

D-Fens joerg-d.schneider at db.com
Mon Jan 29 04:20:20 MST 2007


I created a test case that actually demonstrates that setting a parameter to
be empty space, e.g. :

   processor.addParameter("myparam", "");

would not take into account any default values set in a stylesheet for this
parameter, e.g. :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="html" indent="yes"/>

<xsl:param name="myparam">myvalue</xsl:param>
....
</xsl:stylesheet>

The only way to reset any previously set parameters for a
stylesheet/processor, is (unluckily) to create a new processor via the
ownerTemplate, e.g. :

   processor = processor.ownerTemplate.createProcessor();

This has been tested by me and it works (means: previously set parameters
are cleared in a way that any stylesheet default values are taken).

I'm aware that this might be an expensive operation that would probably
decrease the benefits from caching a processor object, but up till now I
found no other solution to reliably reset/clear stylesheet parameters. Using
"transformNode" isn't an option as per my opinion, since no support for
parameters :-(

I'll post this as a bug.


D-Fens wrote:
> 
> To be honest, the way one can reset stylesheet/xsl parameters once set for
> a xslt processor in IE  is really  a miracle to me , but I'd say the way
> it's done in the newly introduced dojo.xml.XslTransform package might need
> some modifications. As per my XSL experience/knowlege, it's certainly a
> difference, if an xsl parameter has not been set at all or if it has an
> empty string as value - difference is : setting a parameter with an empty
> string  would delete any "default" values set in a stylesheet. Consider
> this stylesheet for instance :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>    <xsl:output method="html" indent="yes"/>
> 
> <xsl:parameter name="language">en</xsl:parameter>
> ....
> </xsl:stylesheet>
> 
> as per my understanding such a stylesheet would mean : if no "language"
> parameter is set, then it defaults to "en".
> 
> Creating a xslt processor in IE via creating a respective template, apply
> a stylesheet to it and hence create a processor from the template creates
> a new processor object with no parameters set so far - I did not test
> this, it's just an assumption.
> 
> Now setting parameters to this processor via "processor.addParameter(name,
> value)" certainly sets a stylesheet parameter for this processor (again,
> not tested, just an assumption :-)
> 
> But how to get rid of these parameters again ? They are applied to the
> processor object, which I learned ;-) is very valuable/expensive and so
> should be cached. Setting a previously set parameter to be an empty
> string, as currently done in dojo.xml.XslTransform (see method
> "removeIeParams" ) is in my opinion not the same as if no parameter were
> set at all and would result in not taking into account any default
> parameters values (see sample/explanation above) - could certainly  lead
> to unexpected behaviour.
> 
> I don't know if setting "default" values for parameters is considered a
> bad software design - I guess it is and unfortunately I'm one of the "bad
> guys" again ;-)
> 
> The only way I see for IE browsers to get rid of previously set parameters 
> could be to re-create the complete processor object - something like :
> 
>    processor = processor.ownerTemplate.createProcessor();
> 
> This, as per my assumption, would create a "fresh" processor from the
> implied stylesheet without any parameters set so far.
> 
> Again, nothing has been tested - it's just an assumption while reviewing
> the code. I would be interested in some comments from IE XSL users, if
> there are any within the dojo user community :-)
> 
> Thanks.
> 

-- 
View this message in context: http://www.nabble.com/dojo.xml.XslTransform-removing-IE-stylesheet-parameters-tf3133335.html#a8687458
Sent from the Dojo mailing list archive at Nabble.com.



More information about the Dojo-interest mailing list