Re: PSVI issues

-----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 UTC