Subject: Re: [xsl] XSLT 2.0, using Schema-aware features From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 12 Jan 2007 17:05:17 GMT |
Mike will correct me if I'm wrong (I hope) but I think that if you do <xsl:template match="foo"> then xslt2 doesn't give any way of telling the system that you intend _all_ the input to be validated against your schema, so it can't do the compile time analysis that it can do in the match="element(foo, some schema type )" case, as you might just throw an unvalidated document at that template and it's supposed to match. This, combined with the fact that you can't use the syntax "element(foo, some schema type ) in a basic system unless you guard it with a use-when means that you are rather short of ooptions. You could use <xsl:template use-when="system-property('xsl:is-schema-aware')='yes'" match="element(foo, some schema type )" ... <xsl:template use-when="system-property('xsl:is-schema-aware')='no'" match="foo" ... but the problem is that you have to duplicate all the ... code (although obviously you could factor that into a named template or something. But my concern here would be that unless you are very careful with the factoring then effectively what yo uhave is two different transformations for two different systems just packaged into one file, and the code paths in the basic system are so different from that in the schema aware system, the extra checks that the SA system did while developing the stylesheet aren't really telling you anything about the templates that are actually used if the stylesheet is deployed by a basic system. I should say this is all speculative on my part, as ive only used the basic system in anger, although i have read the spec a few times by now. It depends a lot on the schema. If you are making use of the fact that the schema defines dozens of elements with the same name but different types, and match on those types, then things are hard to make work on teh basic processor, as you have to move that type knowledge into the match pattern from teh schema. If you know that in fact there is effectively one type per element name, and you are just using the type matching to get the extra compile checks then it's most likely possible to automate the production of a basic stylesheet from teh sa one by just replacing element(foo, some schema type ) by foo with a global change for example. David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSLT 2.0, using Schema-aw, Bill Riegel | Thread | RE: [xsl] XSLT 2.0, using Schema-aw, Bill Riegel |
RE: [xsl] XSLT 2.0, using Schema-a, Michael Kay | Date | Re: [xsl] rendering xml fragment tr, Dimitre Novatchev |
Month |