[xmlschemata] xvif: not for schemas only

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Fri Jun 21 2002 - 07:31:26 UTC

Another frequent comment shows that I haven't been explicit enough in the "genericity" of xvif.

My implementation is currently working only within Relax NG schemas but that's mainly because I wanted to validate it in this context where I wanted to be sure I wasn't breaking anything.

OTH, xvif defines 3 elements (if:pipe, if:transform and if:validate) which have a highly generic semantic:

 -if:pipe is a container
 -if:transform is a transformation
 -if:validate is a validation and raises an exception in case of invalidity

There is no reason why they couldn't be used in other contexts, for instance in a XSLT transformation:

<xsl:pattern match="foo">
 <if:pipe>
  <if:transform type="http://simonstl.com/ns/fragments/">
   <if:apply>
    <fragmentRules xmlns="http://simonstl.com/ns/fragments/">
     <fragmentRule pattern="," split="true" skipFirst="false"
                    repeat="true">
      <applyTo>
       <element localName="foo"/>
      </applyTo>
      <produce>
       <element localName="item"/>
      </produce>
     </fragmentRule>
    </fragmentRules>
   </if:apply>
  </if:transform>
  <if:validate type="http://relaxng.org/ns/structure/1.0>
   <oneOrMore xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
    <element name="item">
     <choice>
      <value>foo</value>
      <value>bar</value>
     </choice>
    </element>
   </oneOrMore>
  </if:validate>
  <xsl:apply-templates/>
 </if:pipe>
</xsl:template>

The XSLT template above would be applying a pipe on the context node ("foo") consisting of:

1) A regular fragmentation to split a comma separated list into a list of item elements.
2) A Relax NG validation on the result
3) And apply the templates on the children elements of the result of the regular fragmentation.

Xvif is also generic enough to be embedded into applications handling full documents. The same kind of integration could be attempted within let's say Ant and a if:pipe seen as an Ant task.

Eric

PS: to subscribe to xmlschemata@xmlschemata.org, please send an email
with "subscribe" in the title or body to
xmlschemata-request@xmlschemata.org .

-- 
See you in San Diego.
                               http://conferences.oreillynet.com/os2002/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------
Received on Fri Jun 21 09:31:27 2002

This archive was generated by hypermail 2.1.8 : Fri Dec 03 2004 - 14:29:47 UTC