>I do NOT want to get additionally:
><subscriberT>
><name>Name2</name>
></subscriberT>
>as now, because this fragment is not valid with xml schema

The concept of taking only those portions of a document which match the
schema is VERY far outside the capabilities of normal parsing. Among other
things, there's the question of exactly what part of the document is the
error, which requires much deeper understanding of the semantics of your
particular document than anything in schemas or XSLT.

The best suggestion I can give you is to parse the document without
validation (so it is parsed successfully whether valid or not), then code
all the validation _and_ filtering logic explicitly into your stylesheet
logic. If you know only one subscriber child is expected, use [1] in your
patterns to select it and ignore any others. Note that this also means your
stylesheet will have to reinvent all the logic associated with default
values.

It would probably make more sense to insist that the source document's
author repair it so it conforms to the schema. If you expect it to match a
specific schema, and it doesn't, it's _wrong_ and you should not be
obligated to accept it. That's the whole point of writing a schema in the
first place: it establishes a specific "contract" for exactly what
documents you intend to accept.

Reply via email to