[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: validation of xslt stylesheets with java
florian wrote: > i was wondering if there is a way to validate xslt stylesheets > somehow? (would be cool if there would be a way with java). XSLT processors generally do some checks of the stylesheet structure when they are "compiling" or "preparing" it, and will report errors at that time. JAXP implicitly acknowledges this step in the creation of a Templates object, but exactly when and how this occurs is going to be implementation dependent, generally speaking. Some errors can only be detected at run-time because they depend on information in an XPath context. Some errors that use XPath expressions but that don't depend on context are detectable ahead of time, but not all processors will look for them. And then http://www.w3.org/TR/REC-xslt/#dtd explains, to some extent, why validation (in the pure XML 1.0 sense) using DTDs is difficult. The biggest hurdle, not clearly mentioned in the spec, is that literal result elements and namespace declarations are allowed to appear in stylesheets, and are more or less random in what they look like and where they can occur. Since DTDs require all elements and attributes to be explicitly declared, and either explicitly referenced or referenced with the all-encompassing "ANY" token, one would have to heavily customize each DTD for each stylesheet. Other schema validation mechanisms may be better equipped to deal with the "random" nature of stylesheets, but it's unlikely. Mike -- Mike J. Brown | http://skew.org/~mike/resume/ Denver, CO, USA | http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|