Re: [xsl] XSLT 2.1: ElementTest against several names?

Subject: Re: [xsl] XSLT 2.1: ElementTest against several names?
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Mon, 1 Dec 2008 13:13:20 +0100 (CET)
Michael Kay wrote:

> >     element(my:element|ns:elem)

> No, there's no such proposal on the table.

  Thanks for your response.

> I would have thought it likely, given a well-designed schema, that
> if it makes sense for a function to accept either of these two
> types, they will have some relationship in the schema. For example,
> they will be members of the same substitition group, or they will
> have the same type. You should then be able to refer to them
> generically using the substitution group name or the type name.

  Mmh, yes, I see the point.  And I think that's the way I would
prefer to achieve this.  But still, I think using the above
ElementTest would be legitimate in some cases, mainly:

    1/ if SA is not available.  In this case, the best one can achieve
       is to use element().  SA is great, but there are several
       reasons one can not have it (one example is an open source
       stylesheet, the developer wants to broaden as possible the
       number of processors its stylesheet will be able to run on;)

    2/ in a multi-schemas transformation, where some schemas are
       completely independent, defined by different organizations, I
       can think of situations where one wants to write a function
       that will accept some well-identified elements from those
       schemas, but does not want to write a schema only to create an
       (artificial) link between them.

  More generally, I think the schemas define the grammar of valid XML
instances, while the stylesheet functions and named templates define
processing on those instance, and the rules for parameter typing can
be different from the rules of the grammar...

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/

Current Thread