This is the RELAX NG schema for the output of the XRefFilter stage of the AntWeave Ant task pipeline processor. It defines the XML available for users to extend AntWeave by writing their own filters.
The documentation is designed to be processed by the rng2xhtml.xsl pretty-printing processor and is how the file is seen via a Web browser.
<start> <element name="aw:file"> <optional> <attribute name="filter"> <text/> </attribute> </optional> <ref name="XRefFilter.chunks"/> </element> </start>
The file consists of an ordered list of chunks and definitions.
<define name="XRefFilter.chunks"> <oneOrMore> <choice> <element name="aw:chunk"> <ref name="chunk.attributes"/> <choice> <oneOrMore> <ref name="code.lines"/> </oneOrMore> <oneOrMore> <ref name="text.lines"/> </oneOrMore> </choice> </element> <element name="aw:definitions"> <ref name="definitions"/> </element> </choice> </oneOrMore> </define>
<define name="definitions"> <attribute name="chunk"> <data type="NCName"/> </attribute> <choice> <interleave> <optional> <element name="aw:usedIn"> <zeroOrMore> <ref name="where"/> </zeroOrMore> </element> </optional> <zeroOrMore> <element name="aw:define"> <attribute name="var"/> <zeroOrMore> <ref name="where"/> </zeroOrMore> </element> </zeroOrMore> </interleave> </choice> </define>
<define name="where"> <element name="aw:where"> <attribute name="ref"> <data type="integer"/> </attribute> </element> </define>
Chunk attributes define the exact nature of that chunk. Some attributes are required and some must be unique. The Schematron checks on the validity of the attributes.
<define name="chunk.attributes"> <sch:pattern name="Check appropriate attributes for either documentation and code"> <sch:rule context="aw:chunk"> <sch:report test="@type = 'code' and not ( @hash )">Code chunks must have associated hash.</sch:report> </sch:rule> </sch:pattern> <sch:pattern name="Check appropriate attributes for either documentation and code"> <sch:rule context="aw:chunk"> <sch:report test="@type = 'code' and not ( @name )">Code chunks must have associated name.</sch:report> </sch:rule> </sch:pattern> <sch:pattern name="Check appropriate attributes for either documentation and code"> <sch:rule context="aw:chunk"> <sch:report test="@type = 'code' and not ( @id )">Code chunks must have associated id.</sch:report> </sch:rule> </sch:pattern> <sch:pattern name="Element 'aw:chunk' must have unique 'id' attribute"> <sch:rule context="aw:chunk/@code"> <sch:assert test="count(//@id[. = current()]) = 1">Id not unique!</sch:assert> </sch:rule> </sch:pattern> <attribute name="type"> <choice> <value>documentation</value> <value>code</value> </choice> </attribute> <ref name="common.attributes"/> <optional> <attribute name="hash"> <data type="NCName"/> </attribute> </optional> <optional> <attribute name="id"> <data type="integer"/> </attribute> </optional> <optional> <attribute name="name"/> </optional> </define>
<define name="common.attributes"> <attribute name="file"> <data type="NCName"/> </attribute> <attribute name="line"> <data type="integer"/> </attribute> </define>
This has a single attribute defining the original source line number.
<define name="text.lines"> <element name="aw:text"> <attribute name="line"> <data type="integer"/> </attribute> <text/> </element> </define>
The hash attribute is a unique number based on the name attribute. The latter is the chunk name in the original NoWeb source (the text between the double angle brackets).
<define name="code.lines"> <element name="aw:code"> <ref name="common.attributes"/> <attribute name="hash"> <data type="NCName"/> </attribute> <attribute name="ref"> <text/> </attribute> <oneOrMore> <choice> <interleave> <ref name="code.token"/> <ref name="code.separator"/> <ref name="code.variable"/> <ref name="code.include"/> </interleave> </choice> </oneOrMore> </element> </define>
<define name="code.token"> <element name="aw:token"> <text/> </element> </define>
<define name="code.separator"> <element name="aw:separator"> <text/> </element> </define>
<define name="code.variable"> <element name="aw:variable"> <text/> </element> </define>
used to include another file (generally used only by tangle).
<define name="code.include"> <element name="aw:include"> <attribute name="file"> <data type="NCName"/> </attribute> <attribute name="hash"> <data type="NCName"/> </attribute> <attribute name="line"> <data type="integer"/> </attribute> <attribute name="ref"/> <text/> </element> </define>