[
Lists Home |
Date Index |
Thread Index
]
Hi Tom,
>> I think that a well-designed stylesheet should reference a schema
>> that contains the type definitions for any types that it uses
>> internally. Otherwise it's like using a named template and
>> expecting the source document to provide its definition; not a wise
>> course of action. In fact, given that (in some applications) you
>> might have a compile-once, use-multiple-times architecture, it
>> would be fatal to refer to a type for which you don't have a
>> definition within a referenced schema.
>
> Here's the situation I was thinking of. You have worked with another
> party who sends you documents according to a schema, but once the
> process is working the schema location isn't included anymore to
> prevent validation of every instance, which you have learned takes
> too long, or because the schema isn't always available (sometimes
> you work off-line and can't connect to the schema's location), but
> you still need to run transformations for some good reason. You have
> confidence that the documents are valid.
>
> This isn't uncommon today with DTDs, and I suppose it will happen
> with X-xxx 2.0 when schemas come into play. With DTDs, you have the
> problem of defaulted and fixed attributes being missing, but they
> are often (usually?) not used. With XML schemas, you hve the problem
> that if the schema is missing, the types are missing too.
Yes, absolutely. In XSLT 1.0, to deal with the first case (of
defaulted and fixed attributes), we make sure that the default
behaviour is the same whether the attribute is absent or present with
the default value. To deal with the missing types, we use keys and
normalize-space().
What I *hope* is that XSLT 2.0 will give you two options.
First, that you could point to the schema from the stylesheet, so that
you can guarantee that the schema document is available (you always
keep all the modules of your stylesheet application together) and that
it's the right one.
Second, that you could do the same kind of thing as is available in
XSLT 1.0 -- that it's possible to write around a lacking schema, so
that you can manipulate the values of attributes as if they were dates
even if you don't have a schema to tell you that they're dates
automatically.
You seemed to be saying before that you wanted some way to make the
schema referenced by the source document provide the types, but your
example demonstrates why that's a bad idea.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
|