W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > May 2008

Re: PSVI issues

From: Henry S. Thompson <ht@inf.ed.ac.uk>
Date: Thu, 08 May 2008 14:44:13 +0100
To: "Innovimax SARL" <innovimax@gmail.com>
Cc: public-xml-processing-model-wg@w3.org
Message-ID: <f5bej8czz9u.fsf@hildegard.inf.ed.ac.uk>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mohamed writes:

> Can you give one or two use cases for psvi-available() ?

<p:group>
 <p:validate-with-xml-schema assert-valid="true">
  <p:input port="schemas">
   <p:inline>
    <xs:schema>
     . . .
     <xs:element name="doomed" abstract="true" type="my:doomedType"/>
     . . .
     <xs:element name="purple" substitutionGroup="my:doomed"/>
     <xs:element name="mauve" substitutionGroup="my:doomed"/>
     <xs:element name="burgundy" substitutionGroup="my:doomed"/>
     . . .
    </xs:schema>
   </p:inline>
  </p:input>
 </p:validate-with-xml-schema>
 <p:choose>
  <p:when test="p:psvi-available()">
   <p:delete match="element(*,my:doomedType)"/>
  </p:when>
  <p:otherwise>
   <p:documentation>
    <p>This is risky, because if the schema is changed to add elts to
       or remove elts from the doomed subst. group,
       this step will need to be updated . . .</p>
   </p:documentation>
   <p:delete match="my:purple|my:mauve|my:burgundy"/>
  </p:otherwise>
 </p:choose>
</p:group>

I.e., schema validate, and then use a type to do some work if it's
there, otherwise revert to an explicit list of elements.  As the
comment says, this will be robust wrt schema changes on the first
branch, but less so on the second. . .

ht
- -- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFIIwOtkjnJixAXWBoRAlMyAJ9T6CNQa8WO3umZLkqUhqkS/mzLIACfTZyM
SmlwbH+pU2fdE3IYafbsNzE=
=uq7O
-----END PGP SIGNATURE-----
Received on Thursday, 8 May 2008 13:44:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 8 May 2008 13:44:49 GMT