<?xml version="1.0" encoding="UTF-8"?>
<!--
    OASIS OpenDocument v1.2
	Committee Draft 05, 19 June 2010
    Relax-NG Schema

	Copyright © OASIS Open 2002-2009. All Rights Reserved.

	All capitalized terms in the following text have the meanings assigned to them
   	in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The
	full Policy may be found at the OASIS website.

	This document and translations of it may be copied and furnished to others, and
	derivative works that comment on or otherwise explain it or assist in its
	implementation may be prepared, copied, published, and distributed, in whole or
	in part, without restriction of any kind, provided that the above copyright
	notice and this section are included on all such copies and derivative works.
	However, this document itself may not be modified in any way, including by
	removing the copyright notice or references to OASIS, except as needed for the
	purpose of developing any document or deliverable produced by an OASIS
	Technical Committee (in which case the rules applicable to copyrights, as set
	forth in the OASIS IPR Policy, must be followed) or as required to translate it
	into languages other than English.

	The limited permissions granted above are perpetual and will not be revoked by
	OASIS or its successors or assigns.

	This document and the information contained herein is provided on an "AS IS"
	basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
	LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
	INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR
	FITNESS FOR A PARTICULAR PURPOSE. 
-->
<!-- This file contains a large portion of text copied from OpenDocument-v1.2-cd05-schema.rng
     file and therefore retains the OASIS copyright notice/permissions above. -->
<!-- $Id: odt-delta.rng 6836 2010-07-30 14:15:03Z nigelw $ -->
<grammar 
  xmlns="http://relaxng.org/ns/structure/1.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
  xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
  xmlns:split="http://www.deltaxml.com/ns/track-changes/split-namespace"
  xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
  xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">


  <!--
    Status:  partial ODF/track-changes integration covering all of our test files
    (which are mainly text and one spreadsheet).
    Many of the -attlist, -attr and -attrs definitions need to be checked.
    If we do this again we can probably use XSLT to identity:  mixed/text, element-only and empty content
    and add the 'level2' patterns appropriately.
  -->

  <include href="delta-format.rng"/>
    
  <include href="OpenDocument-v1.2-cd05-schema.rng">
     
    <!-- These rules need re definition because cannot combine an ordered definition -->
    <define name="office-text-content-prelude">
      <optional> <!-- Rule 1-->
        <ref name="delta-change-transaction-definitions"/>
      </optional>
      <ref name="office-forms"/>
      <ref name="text-tracked-changes"/>
      <ref name="text-decls"/>
      <ref name="table-decls"/>
    </define>
    
    
    <define name="office-spreadsheet-content-prelude">
      <optional> <!-- Rule 1-->
        <ref name="delta-change-transaction-definitions"/>
      </optional>
      <optional>
        <ref name="table-tracked-changes"/>
      </optional>
      <ref name="text-decls"/>
      <ref name="table-decls"/>
    </define>
    
    <!-- cant interleave with the following 3 defines because of their defined ordering -->
    <define name="text-list-item-content">
      <optional>
        <ref name="text-number"/>
      </optional>
      <zeroOrMore>
        <choice>
          <ref name="text-p"/>
          <ref name="text-h"/>
          <ref name="text-list"/>
          <ref name="text-soft-page-break"/>
          <ref name="delta-level2-content"/>
        </choice>
      </zeroOrMore>
    </define>
    
   
    <define name="table-table-row">
      <element name="table:table-row">
        <ref name="table-table-row-attlist"/>
        <oneOrMore>
          <choice>
            <ref name="table-table-cell"/>
            <ref name="table-covered-table-cell"/>
            <ref name="delta-level2-content"/>
          </choice>
        </oneOrMore>
      </element>
    </define>
    
    <define name="text-list">
      <element name="text:list">
        <ref name="text-list-attr"/>
        <optional>
          <ref name="text-list-header"/>
        </optional>
        <zeroOrMore>
          <choice> <!-- added this choice -->
            <ref name="text-list-item"/>
            <ref name="delta-level2-content"/>
          </choice>
        </zeroOrMore>
      </element>
    </define>
    
      <!-- Need to redefine (copy-n-paste) paragraph-content here because 
        we need to extend mixed content used in the child elements here.
        This was certainly easier to do in CD04 which made more use of combine attributes
        in RelaxNG. -->
      <define name="paragraph-content">
        <choice>
            <text/>
            <element name="text:s">
                <optional>
                    <attribute name="text:c">
                        <ref name="nonNegativeInteger"/>
                    </attribute>
                </optional>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:tab">
                <ref name="text-tab-attr"/>
            </element>
            <element name="text:line-break">
                <ref name="delta-level2-attributes"/>
                <empty/>
            </element>
            <ref name="text-soft-page-break"/>
            <element name="text:span">
                <optional>
                    <attribute name="text:style-name">
                        <ref name="styleNameRef"/>
                    </attribute>
                </optional>
                <optional>
                    <attribute name="text:class-names">
                        <ref name="styleNameRefs"/>
                    </attribute>
                </optional>
                <ref name="delta-level2-wrapper-attributes"/>
                <zeroOrMore>
                    <ref name="paragraph-content-or-hyperlink"/>
                </zeroOrMore>
            </element>
            <element name="text:meta">
                <ref name="text-meta-attlist"/>
                <zeroOrMore>
                    <ref name="paragraph-content-or-hyperlink"/>
                </zeroOrMore>
            </element>
            <choice>
                <ref name="text-bookmark"/>
                <ref name="text-bookmark-start"/>
                <ref name="text-bookmark-end"/>
            </choice>
            <element name="text:reference-mark">
                <attribute name="text:name">
                    <ref name="string"/>
                </attribute>
                <ref name="delta-level2-attributes"/>
            </element>
            <choice>
                <element name="text:reference-mark-start">
                    <attribute name="text:name">
                        <ref name="string"/>
                    </attribute>
                    <ref name="delta-level2-attributes"/>
                </element>
                <element name="text:reference-mark-end">
                    <attribute name="text:name">
                        <ref name="string"/>
                    </attribute>
                    <ref name="delta-level2-attributes"/>
                </element>
            </choice>
            <element name="text:note">
                <ref name="text-note-class"/>
                <optional>
                    <attribute name="text:id">
                        <ref name="string"/>
                    </attribute>
                </optional>
                <ref name="delta-level2-attributes"/>
                <element name="text:note-citation">
                    <optional>
                        <attribute name="text:label">
                            <ref name="string"/>
                        </attribute>
                    </optional>
                    <ref name="delta-level2-attributes"/>
                    <interleave>
                      <text/>
                      <ref name="delta-level2-mixed-content"/>
                    </interleave>
                </element>
                <element name="text:note-body">
                    <zeroOrMore>
                        <ref name="text-content"/>
                    </zeroOrMore>
                </element>
            </element>
            <element name="text:ruby">
                <optional>
                    <attribute name="text:style-name">
                        <ref name="styleNameRef"/>
                    </attribute>
                </optional>
                <ref name="delta-level2-attributes"/>
                <element name="text:ruby-base">
                    <ref name="delta-level2-attributes"/>
                    <zeroOrMore>
                        <ref name="paragraph-content-or-hyperlink"/>
                    </zeroOrMore>
                </element>
                <element name="text:ruby-text">
                    <optional>
                        <attribute name="text:style-name">
                            <ref name="styleNameRef"/>
                        </attribute>
                    </optional>
                    <ref name="delta-level2-attributes"/>
                     <interleave>
                        <ref name="delta-level2-mixed-content"/> 
                        <text/>
                     </interleave>
                </element>
            </element>
            <choice>
                <ref name="office-annotation"/>
                <ref name="office-annotation-end"/>
            </choice>
            <ref name="change-marks"/>
            <ref name="shape"/>
            <element name="text:date">
                <ref name="text-date-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>  
            </element>
            <element name="text:time">
                <ref name="text-time-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>  
            </element>
            <element name="text:page-number">
                <ref name="text-page-number-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:page-continuation">
                <ref name="text-page-continuation-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-firstname">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-lastname">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-initials">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-title">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-position">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-email">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-phone-private">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-fax">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-company">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-phone-work">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-street">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-city">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-postal-code">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-country">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sender-state-or-province">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:author-name">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:author-initials">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:chapter">
                <ref name="text-chapter-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:file-name">
                <ref name="text-file-name-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:template-name">
                <ref name="text-template-name-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sheet-name">
               <ref name="delta-level2-attributes"/>
               <interleave>
                 <ref name="delta-level2-mixed-content"/>
                 <text/>
               </interleave>
            </element>
            <element name="text:variable-set">
                <interleave>
                    <ref name="common-field-name-attlist"/>
                    <ref name="common-field-formula-attlist"/>
                    <ref name="common-value-and-type-attlist"/>
                    <ref name="common-field-display-value-none-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:variable-get">
                <interleave>
                    <ref name="common-field-name-attlist"/>
                    <ref name="common-field-display-value-formula-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:variable-input">
                <interleave>
                    <ref name="common-field-name-attlist"/>
                    <ref name="common-field-description-attlist"/>
                    <ref name="common-value-type-attlist"/>
                    <ref name="common-field-display-value-none-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:user-field-get">
                <interleave>
                    <ref name="common-field-name-attlist"/>
                    <ref name="common-field-display-value-formula-none-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:user-field-input">
                <interleave>
                    <ref name="common-field-name-attlist"/>
                    <ref name="common-field-description-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:sequence">
                <interleave>
                    <ref name="common-field-name-attlist"/>
                    <ref name="common-field-formula-attlist"/>
                    <ref name="common-field-num-format-attlist"/>
                    <ref name="text-sequence-ref-name"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:expression">
                <interleave>
                    <ref name="common-field-formula-attlist"/>
                    <optional>
                        <ref name="common-value-and-type-attlist"/>
                    </optional>
                    <ref name="common-field-display-value-formula-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:text-input">
                <ref name="common-field-description-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:initial-creator">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:creation-date">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="text:date-value">
                            <ref name="dateOrDateTime"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:creation-time">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="text:time-value">
                            <ref name="timeOrDateTime"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:description">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:user-defined">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <attribute name="text:name">
                        <ref name="string"/>
                    </attribute>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="office:value">
                            <ref name="double"/>
                        </attribute>
                    </optional>
                    <optional>
                        <attribute name="office:date-value">
                            <ref name="dateOrDateTime"/>
                        </attribute>
                    </optional>
                    <optional>
                        <attribute name="office:time-value">
                            <ref name="duration"/>
                        </attribute>
                    </optional>
                    <optional>
                        <attribute name="office:boolean-value">
                            <ref name="boolean"/>
                        </attribute>
                    </optional>
                    <optional>
                        <attribute name="office:string-value">
                            <ref name="string"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:print-time">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="text:time-value">
                            <ref name="time"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:print-date">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="text:date-value">
                            <ref name="date"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:printed-by">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:title">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:subject">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:keywords">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:editing-cycles">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:editing-duration">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="text:duration">
                            <ref name="duration"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:modification-time">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="text:time-value">
                            <ref name="time"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:modification-date">
                <interleave>
                    <ref name="common-field-fixed-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                    <optional>
                        <attribute name="text:date-value">
                            <ref name="date"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:creator">
                <ref name="common-field-fixed-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element>
                <choice>
                    <name>text:page-count</name>
                    <name>text:paragraph-count</name>
                    <name>text:word-count</name>
                    <name>text:character-count</name>
                    <name>text:table-count</name>
                    <name>text:image-count</name>
                    <name>text:object-count</name>
                </choice>
                <ref name="common-field-num-format-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:database-display">
                <ref name="text-database-display-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:database-next">
                <ref name="text-database-next-attlist"/>
            </element>
            <element name="text:database-row-select">
                <ref name="text-database-row-select-attlist"/>
            </element>
            <element name="text:database-row-number">
                <interleave>
                    <ref name="common-field-database-table"/>
                    <ref name="common-field-num-format-attlist"/>
                    <optional>
                        <attribute name="text:value">
                            <ref name="nonNegativeInteger"/>
                        </attribute>
                    </optional>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:database-name">
                <ref name="common-field-database-table"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:page-variable-set">
                <ref name="text-set-page-variable-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:page-variable-get">
                <ref name="text-get-page-variable-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:placeholder">
                <ref name="text-placeholder-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:conditional-text">
                <ref name="text-conditional-text-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:hidden-text">
                <ref name="text-hidden-text-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element>
                <choice>
                    <name>text:reference-ref</name>
                    <name>text:bookmark-ref</name>
                </choice>
                <interleave>
                    <ref name="text-common-ref-content"/>
                    <ref name="text-bookmark-ref-content"/>
                </interleave>
            </element>
            <element name="text:note-ref">
                <interleave>
                    <ref name="text-common-ref-content"/>
                    <ref name="text-note-ref-content"/>
                </interleave>
            </element>
            <element name="text:sequence-ref">
                <interleave>
                    <ref name="text-common-ref-content"/>
                    <ref name="text-sequence-ref-content"/>
                </interleave>
            </element>
            <element name="text:script">
                <interleave>
                    <ref name="delta-level2-attributes"/>
                    <choice>
                        <group>
                            <attribute name="xlink:type">
                                <value>simple</value>
                            </attribute>
                            <attribute name="xlink:href">
                                <ref name="anyURI"/>
                            </attribute>
                        </group>
                        <interleave>
                          <ref name="delta-level2-mixed-content"/>
                          <text/>
                        </interleave>
                    </choice>
                    <optional>
                        <attribute name="script:language">
                            <ref name="string"/>
                        </attribute>
                    </optional>
                </interleave>
            </element>
            <element name="text:execute-macro">
                <optional>
                    <attribute name="text:name">
                        <ref name="string"/>
                    </attribute>
                </optional>
                <ref name="delta-level2-attributes"/>
                <optional>
                    <ref name="office-event-listeners"/>
                </optional>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:hidden-paragraph">
                <ref name="text-hidden-paragraph-attlist"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:dde-connection">
                <attribute name="text:connection-name">
                    <ref name="string"/>
                </attribute>
                <ref name="delta-level2-attributes"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:measure">
                <attribute name="text:kind">
                    <choice>
                        <value>value</value>
                        <value>unit</value>
                        <value>gap</value>
                    </choice>
                </attribute>
                <ref name="delta-level2-attributes"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:table-formula">
                <interleave>
                    <ref name="common-field-formula-attlist"/>
                    <ref name="common-field-display-value-formula-attlist"/>
                    <ref name="common-field-data-style-name-attlist"/>
                </interleave>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="text:meta-field">
                <ref name="text-meta-field-attlist"/>
                <zeroOrMore>
                    <ref name="paragraph-content-or-hyperlink"/>
                </zeroOrMore>
            </element>
            <element name="text:toc-mark-start">
                <ref name="text-toc-mark-start-attrs"/>
            </element>
            <element name="text:toc-mark-end">
                <ref name="text-id"/>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:toc-mark">
                <attribute name="text:string-value">
                    <ref name="string"/>
                </attribute>
                <ref name="text-outline-level"/>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:user-index-mark-start">
                <ref name="text-id"/>
                <ref name="text-outline-level"/>
                <ref name="text-index-name"/>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:user-index-mark-end">
                <ref name="text-id"/>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:user-index-mark">
                <attribute name="text:string-value">
                    <ref name="string"/>
                </attribute>
                <ref name="text-outline-level"/>
                <ref name="text-index-name"/>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:alphabetical-index-mark-start">
                <ref name="text-id"/>
                <ref name="text-alphabetical-index-mark-attrs"/>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:alphabetical-index-mark-end">
                <ref name="text-id"/>
                <ref name="delta-level2-attributes"/>
            </element>
            <element name="text:alphabetical-index-mark">
                <attribute name="text:string-value">
                    <ref name="string"/>
                </attribute>
                <ref name="text-alphabetical-index-mark-attrs"/>
            </element>
            <element name="text:bibliography-mark">
                <attribute name="text:bibliography-type">
                    <ref name="text-bibliography-types"/>
                </attribute>
                <zeroOrMore>
                    <attribute>
                        <choice>
                            <name>text:identifier</name>
                            <name>text:address</name>
                            <name>text:annote</name>
                            <name>text:author</name>
                            <name>text:booktitle</name>
                            <name>text:chapter</name>
                            <name>text:edition</name>
                            <name>text:editor</name>
                            <name>text:howpublished</name>
                            <name>text:institution</name>
                            <name>text:journal</name>
                            <name>text:month</name>
                            <name>text:note</name>
                            <name>text:number</name>
                            <name>text:organizations</name>
                            <name>text:pages</name>
                            <name>text:publisher</name>
                            <name>text:school</name>
                            <name>text:series</name>
                            <name>text:title</name>
                            <name>text:report-type</name>
                            <name>text:volume</name>
                            <name>text:year</name>
                            <name>text:url</name>
                            <name>text:custom1</name>
                            <name>text:custom2</name>
                            <name>text:custom3</name>
                            <name>text:custom4</name>
                            <name>text:custom5</name>
                            <name>text:isbn</name>
                            <name>text:issn</name>
                        </choice>
                        <ref name="string"/>
                    </attribute>
                </zeroOrMore>
                <ref name="delta-level2-attributes"/>
                <interleave>
                  <ref name="delta-level2-mixed-content"/>
                  <text/>
                </interleave>
            </element>
            <element name="presentation:header">
                <ref name="delta-level2-attributes"/>
                <empty/>
            </element>
            <element name="presentation:footer">
                <ref name="delta-level2-attributes"/>
                <empty/>
            </element>
            <element name="presentation:date-time">
                <ref name="delta-level2-attributes"/>
                <empty/>
            </element>
        </choice>
    </define>
  </include>
  
  <define name="paragraph-content" combine="choice">
    <ref name="delta-level2-mixed-content"/>
  </define>

  <define name="text-content" combine="choice">
    <ref name="delta-level2-content"/>
  </define>
  
  <define name="table-rows-and-groups" combine="interleave">
    <ref name="delta-level2-content"/>
  </define>


  <define name="paragraph-attrs" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>
  
  <define name="common-style-header-footer-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>

  <define name="style-header-footer-properties-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>
  
  <define name="style-style-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define> 
  
  <define name="table-table-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>
  
  <define name="table-table-cell-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>

  <define name="table-table-row-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>

  <define name="table-table-column-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>

  <define name="style-table-column-properties-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>

  <define name="style-table-cell-properties-attlist" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>
  
  <define name="text-list-item-attr" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>
  
  <define name="text-list-attr" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>
  
  <define name="text-list-style-attr" combine="interleave">
    <ref name="delta-level2-attributes"/>
  </define>
</grammar>