how do you get Xalan to validate stylesheets?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Lars
Posts: 10
Joined: Sat Jan 15, 2005 12:12 am

how do you get Xalan to validate stylesheets?

Post by Lars »

Hi,
This is not really a question about how to use Oxygen, but rather a "how did you do that?" question.

We are using Xalan for XSLT transformation in another environment, namely, within Cocoon. When we feed it stylesheets that have structural errors in them, Xalan sometimes does not complain but merely generates incorrect output. Or it gives an error message that bears no apparent relationship to the actual mistake in the stylesheet. Saxon does a better job. For example, if the stylesheet contains an <xsl:choose> that has a <debug> child element, Xalan (under Cocoon) gives an irrelevant error message, but Saxon gives a helpful one.

However, in Oxygen, when I validate the aforementioned stylesheet (Shift+Ctrl+V) using Xalan, it gives a pertinent error message similar to Saxon's. So my question is, how did you do that? Do you have to pass parameters to Xalan, or call a particular class?

(It's possible that the difference is that I'm using an older version of Xalan under Cocoon. But I don't think so. In any case, knowing how you got Xalan to validate a stylesheet in Oxygen would help me solve this problem.)

Thanks,
Lars
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Lars,

At David Sewell's suggestion I just created a new forum for exactly this kind of questions.

For validation we perform two actions. First is to check that the stylehseet document is an well formed XML document. Then the validation is performed by trying to create a Transformer object from the stylesheet document. Make sure you register an ErrorListener on the TransformerFactory. If that does not give you the expected errors try also updating your Xalan to a newer version. We are using 2.5.1 as we found it to be more stable than 2.6.0.

Best Regards,
George
Post Reply