Bug 208836 - [xslt] XSL Validation within WTP Validator framework
Summary: [xslt] XSL Validation within WTP Validator framework
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xsl (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.1   Edit
Assignee: Jesper Moller CLA
QA Contact: David Williams CLA
URL:
Whiteboard:
Keywords:
Depends on: 222909
Blocks: 224197
  Show dependency tree
 
Reported: 2007-11-05 20:00 EST by Jesper Moller CLA
Modified: 2009-04-30 14:27 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesper Moller CLA 2007-11-05 20:00:56 EST
As part of the XSL tooling proposal in bug 206826, this issue deals with validation of XSLT files.

XSLT files are tricky to validate, since their schema is version sensitive and contain fragments of the generated grammar mixed in with the XSLT parts. The initial pass at a validator must filter out the non XSLT-parts and only focus on the XSLT constructs themselves.

Here is a list of requirements as a starting point:

R1. The validator must be active for all XSLT files, and can run as part of the WTP validation framework.

R2. The validator must be able to work (even if in degraded mode) on incomplete templates (where include/imports cannot be resolved).

R3: XSLT files must be checked for structural validity:

R3.1: Valid XLST implies well-formed XML. This must be checked and reported in a fashion consistent with the regular WST XML validator.

R3.2: Any XML errors must be reported exactly once (i.e. avoid overlap with exsisting XML validator)

R3.3: Tags which are not part of the XSLT structure must be ignored.

R3.4: XSLT tags in use must be valid w.r.t. allowed attributes and element names in the XSLT namespace. Careful: There is a versioning rule to adhere to [1].

R3.5: XSLT tags in use must be valid w.r.t. the nesting of elements (i.e. xsl:with-param can only occur within xsl:call-template, etc.)

R4: XSLT files should be checked for logical validity:

R4.1: Named entities (i.e. template names, modes, keys, named parameters, variables) must be checked for existence (error) and non-use (warning). For extra credit, the warning can be a preference setting (may make sense for include files)

R4.2: XPath expressions must be parsable

R4.3: Variable expressions used in XPath expressions must be checked according to R4.1.

R4.3: Keys used in XPath expressions must be checked according to R4.1.

R4.4: XML namespace prefixes used in XPath expressions must be active in the context they appear in.

R4.5: XPath functions must be checked for names and arity. A preferences section can be used to declare extension XPath functions.

OK, this is possibly too much for an initial implementation, but at least then it's recorded somewhere. In fact, much of this may be implemented by constructing a JAXT Transformer object and watching for errors, but this may not provide R2, I'm not sure.

And I didn't even get to:

R5: Statically validate the output of the XLST template. A theis was written on this a few years back [2].

Comments, rants, raves?

[1]: http://www.biglist.com/lists/xsl-list/archives/200410/msg00751.html
[2]: http://www.daimi.au.dk/~madman/xsltvalidation/
Comment 1 David Carver CLA 2008-03-23 12:51:43 EDT
related to bug 222909
Comment 2 David Carver CLA 2008-06-05 21:41:34 EDT
Mass Migration to wtp.inc.xsl
Comment 3 Doug CLA 2008-06-26 09:49:27 EDT
Jesper - can you revisit this bug and tick off what you think we have implemented, and what remains to be achieved. Perhaps we should create separate bug reports for the bits that are left to do?
Comment 4 Doug CLA 2008-07-25 07:49:39 EDT
Marking this as fixed. Any incomplete enhancements can be raised as separate bugs.
Comment 5 David Carver CLA 2008-08-12 08:09:39 EDT
Jesper is there anything that we missed?   We probably should open a separate bug for the missing items so we can try to get them in for 1.0.
Comment 6 David Carver CLA 2009-04-30 14:27:09 EDT
mass update to 3.1 target due to movement from wtp incubator to wtp source editing lost the original milestones.