You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Roytman, Alex" <ro...@peacetech.com> on 2000/09/20 18:45:04 UTC

Stylesheets. Conditional Compiles

Just an idea. It seems to me that Conditional Compiles for stylesheets might
be very useful. 

What I mean is to use something like 
<xsl:if-def def-name="VERBOSE">
  do something
</xsl:if-def>

and then 

XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.setConditionalDef("VERBOSE")
StylesheetRoot style = processor.processStylesheet(new
XSLTInputSource(uri));

to tell processor which parts of a stylesheet should be included in compiled
stylesheet.

Very often we need alter stylesheet output based on some set of predefined
options.
It can be achieved with parameters and xsl:if, xsl:switch statements but if
this conditional bit of code happens to be inside of innermost loop you will
pay high price for it. But if you use conditional compile it is different
story.
It should be pretty easy to implement I think. It could be external to Xalan
(filter on SAX events) but it would be nice to have if built into Xalan