Yasundial.ORGの共通デザイン


スキーマ定義

現時点で定義しているスキーマは次の通りです。

$ cat schema/book.rng
<?xml version="1.0" encoding="UTF-8" ?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <choice>
      <ref name="doc" />
    </choice>
  </start>

  <!-- doc -->
  <define name="doc">
    <element name="doc">
      <attribute name="id" />
      <optional>
	<ref name="head" />
	<ref name="body" />
      </optional>
    </element>
  </define>
  
  <!-- head -->
  <define name="head">
    <element name="head">
      <interleave>
	<ref name="title" />
	<ref name="abstract" />
	<zeroOrMore>
	  <ref name="keyword" />
	</zeroOrMore>
      </interleave>
    </element>
  </define>
  <define name="title">
    <element name="title">
      <text />
    </element>
  </define>
  <define name="abstract">
    <element name="abstract">
      <text />
    </element>
  </define>
  <define name="keyword">
    <element name="keyword">
      <attribute name="name" />
    </element>
  </define>

  <!-- body -->
  <define name="body">
    <element name="body">
      <interleave>
	<zeroOrMore>
	  <ref name="compare_block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="common_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="part" />
	</zeroOrMore>
      </interleave>
    </element>
  </define>
  <define name="part">
    <element name="part">
      <interleave>
	<attribute name="title" />
	<optional>
	  <attribute name="id" />
	</optional>
      </interleave>
      <interleave>
	<zeroOrMore>
	  <ref name="compare_block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="common_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="chapter" />
	</zeroOrMore>
      </interleave>
    </element>
  </define>
  <define name="chapter">
    <element name="chapter">
      <interleave>
	<attribute name="title" />
	<optional>
	  <attribute name="id" />
	</optional>
      </interleave>
      <interleave>
	<zeroOrMore>
	  <ref name="compare_block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="common_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="section" />
	</zeroOrMore>
      </interleave>
    </element>
  </define>
  <define name="section">
    <element name="section">
      <interleave>
	<attribute name="title" />
	<optional>
	  <attribute name="id" />
	</optional>
      </interleave>
      <interleave>
	<zeroOrMore>
	  <ref name="compare_block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="block_contents" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="common_contents" />
	</zeroOrMore>
      </interleave>
    </element>
  </define>

  <!-- compare_block_contents: Not the SmartDoc elemnt -->
  <define name="compare_block_contents">
    <choice>
      <ref name="compare" />
      <ref name="annotate" />
    </choice>
  </define>
  <define name="compare">
    <element name="compare">
      <ref name="before" />
      <ref name="after" />
    </element>
  </define>
  <define name="before">
    <element name="before">
      <zeroOrMore>
	<ref name="block_contents" />
      </zeroOrMore>
    </element>
  </define>
  <define name="after">
    <element name="after">
      <zeroOrMore>
	<ref name="block_contents" />
      </zeroOrMore>
    </element>
  </define>
  <!-- ya annotate -->
  <define name="annotate">
    <element name="annotate">
      <ref name="before_annotate" />
      <ref name="after_annotate" />
    </element>
  </define>
  <define name="before_annotate">
    <element name="before_annotate">
      <zeroOrMore>
	<ref name="block_contents" />
      </zeroOrMore>
    </element>
  </define>
  <define name="after_annotate">
    <element name="after_annotate">
      <zeroOrMore>
	<ref name="block_contents" />
      </zeroOrMore>
    </element>
  </define>

  <!-- block_contents -->
  <define name="block_contents">
    <choice>
      <ref name="p" />
      <ref name="ul" />
      <ref name="program" />
      <ref name="note" />
    </choice>
  </define>
  <define name="p">
    <element name="p">
      <interleave>
	<zeroOrMore>
	  <ref name="common_text" />
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="common_contents" />
	</zeroOrMore>
      </interleave>
    </element>
  </define>
  <define name="ul">
    <element name="ul">
      <zeroOrMore>
	<ref name="li" />
      </zeroOrMore>
    </element>
  </define>
  <define name="li">
    <element name="li">
      <zeroOrMore>
	<ref name="common_text" />
      </zeroOrMore>
      <optional>
	<ref name="ul" />
      </optional>
    </element>
  </define>
  <define name="program">
    <element name="program">
      <ref name="common_attrs" />
      <zeroOrMore>
	<ref name="common_text" />
      </zeroOrMore>
    </element>
  </define>
  <define name="note">
    <element name="note">
      <ref name="common_attrs" />
      <zeroOrMore>
	<ref name="common_text" />
      </zeroOrMore>
    </element>
  </define>
  
  <!-- common_text -->
  <define name="common_text">
    <choice>
      <ref name="a" />
      <ref name="cite" />
      <ref name="img" />
      <ref name="em" />
      <ref name="q" />
      <ref name="dfn" />
      <ref name="code" />
      
      <!-- non-smartdoc tags -->
      <ref name="foaf" />
      <ref name="abbr" />
      <ref name="ruby" />
      <text />
    </choice>
  </define>
  <define name="a">
    <element name="a">
      <interleave>
	<optional>
	  <attribute name="href"/>
	</optional>
	<optional>
	  <attribute name="title"/>
	</optional>
      </interleave>
      <choice>
	<empty />
	<ref name="common_text" />
      </choice>
    </element>
  </define>
  <define name="cite">
    <element name="cite">
      <interleave>
	<optional>
	  <attribute name="href"/>
	</optional>
	<optional>
	  <attribute name="title"/>
	</optional>
      </interleave>
      <text />
    </element>
  </define>
  <define name="img">
    <element name="img">
      <interleave>
	<ref name="common_attrs" />
	<attribute name="alt" />
      </interleave>
      <empty />
    </element>
  </define>
  <define name="em">
    <element name="em">
      <text />
    </element>
  </define>
  <define name="q">
    <element name="q">
      <text />
    </element>
  </define>
  <define name="dfn">
    <element name="dfn">
      <interleave>
	<attribute name="alt" />
	<attribute name="src" />
      </interleave>
      <empty />
    </element>
  </define>
  <define name="code">
    <element name="code">
      <ref name="common_text" />
    </element>
  </define>
  <!-- non-smartdoc tags -->
  <define name="foaf">
    <element name="foaf">
      <interleave>
	<ref name="common_attrs" />
	<attribute name="alt" />
      </interleave>
      <empty />
    </element>
  </define>
  <define name="abbr">
    <element name="abbr">
      <interleave>
	<optional>
	  <attribute name="src"/>
	</optional>
	<optional>
	  <attribute name="title"/>
	</optional>
      </interleave>
      <choice>
	<empty />
	<ref name="common_text" />
      </choice>
    </element>
  </define>
  <define name="ruby">
    <element name="ruby">
      <interleave>
	<optional>
	  <attribute name="src"/>
	</optional>
	<optional>
	  <attribute name="title"/>
	</optional>
      </interleave>
      <choice>
	<empty />
	<ref name="common_text" />
      </choice>
    </element>
  </define>

  <!-- common_contents -->
  <define name="common_contents">
    <interleave>
      <zeroOrMore>
	<ref name="console" />
      </zeroOrMore>
    </interleave>
  </define>
  <define name="console">
    <element name="console">
      <ref name="common_attrs" />
      <zeroOrMore>
	<ref name="common_text" />
      </zeroOrMore>
    </element>
  </define>

  <!-- common_attr -->
  <define name="common_attrs">
    <interleave>
      <optional>
	<attribute name="src"/>
      </optional>
      <optional>
	<attribute name="title"/>
      </optional>
      <optional>
	<attribute name="id"/>
      </optional>
      <optional>
	<attribute name="class"/>
      </optional>
      <optional>
	<attribute name="normalizer"/>
      </optional>
    </interleave>
  </define>
</grammar>

      
Permalink: /design/0.1/cms_schema.html

Created: 2011-02-23T15:29:20+09:00
Last modified: 2011-02-23T15:33:15+09:00

2009-2011 © Yasuhiro ABE <yasu@yasundial.org>

Valid XHTML + RDFa 正当なCSSです!
RDFa it (RDF/XML)!

Creative Commons License www.yasundial.org by Yasuhiro ABE is licensed under a Creative Commons Attribution 2.1 Japan License. Permissions beyond the scope of this license may be available at http://www.yasundial.org/info/license.html.