[Schematron] Possible new extension to Schematron:
George Cristian Bina
george at oxygenxml.com
Mon Nov 23 09:06:50 EST 2009
Oops, sorry for the
<value-of select="name"/> and <value-of
select="x:getDogs()//dogs/dog[1]/name"/>
garbage in the second assert, it remained there from my tests.
Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
George Cristian Bina wrote:
> Hi Rick,
>
> Two possibilities with the existing functionality (allowForeign set to
> true), both included in the sample below:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <let name="dogs" value="document('')//dogs"/>
> <xsl:function name="x:getDogs" xmlns:x="http://example.com/dogs"
> xmlns="">
> <dogs>
> <dog><name>Pip</name><age>8</age></dog>
> <dog><name>Sammy</name><age>13</age></dog>
> <dog><name>Woofer</name><age>11</age></dog>
> </dogs>
> </xsl:function>
>
> <pattern id="test1">
> <rule context="pet">
> <assert test="name = $dogs/dog/name">
> 1:The dog should be on the allowed list of dogs.
> </assert>
> </rule>
> </pattern>
>
> <ns uri="http://example.com/dogs" prefix="x"/>
> <pattern id="test2">
> <rule context="pet">
> <assert test="name = x:getDogs()/dog/name" >
> 2:The dog should be on the allowed list of dogs.
> <value-of select="name"/> and <value-of
> select="x:getDogs()//dogs/dog[1]/name"/>
> </assert>
> </rule>
> </pattern>
> </schema>
>
>
> Best Regards,
> George
More information about the Schematron
mailing list