The default-validation Attribute


The default-validation Attribute

The default-validation attribute on the <xsl:stylesheet> element can take one of the four values «strict », «lax », «preserve », or «strip », and it defines the default that is used on any of the instructions <xsl:attribute>, <xsl:copy>, <xsl:copy-of >, <xsl:document>, <xsl:element>, and <xsl:result-document> when neither a type nor a validation attribute is specified explicitly.

The default value for the default-validation attribute is «strip » . Personally, I would be cautious about changing it to any other value for the following reasons:

  • Changing it to ' «strict » will give you problems unless every element and attribute that you create is declared globally in a schema, which is unlikely .

  • Changing it to «lax » is more likely to give acceptable results, but could lead to performance problems through excessive validation. Validation is an expensive thing to do, and should probably be requested explicitly at the point where you want it.

  • Changing it to «preserve » may lead to rather patchy results in terms of which elements and attributes carry a type annotation, and which are left as untyped. Preserving type annotations makes most sense when you are explicitly copying data from one document to another, and it's probably best to request it explicitly on the instructions that do the copying.

But there may well be use cases I haven't thought of, and if you find yourself using the same value of the validation attribute throughout the stylesheet, then defining a default at the stylesheet module level may turn out to be a useful thing to do.




XSLT 2.0 Programmer's Reference
NetBeansв„ў IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications (2nd Edition)
ISBN: 764569090
EAN: 2147483647
Year: 2003
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net