speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
296 stars 36 forks source link

Allow notes of a different schema in the layout root node #144

Closed neolithos closed 6 years ago

neolithos commented 6 years ago

I did not find any combination possibilities, like "customer specific report includes a master report".

The layout file is xml, so it easy to do this with a little pre processing.

<Layout xmlns="..." xmlns:i="awesome_schema">
  <i:include file="bla.xml" />
...

So, it would be nice, if the schema and speedata publisher silently ignores such tags in the root node.

pgundlach commented 6 years ago

I'll have a look, thanks for the report!

pgundlach commented 6 years ago

This is a note for myself:

   <define name="anything">
      <zeroOrMore>
         <choice>
            <element>
               <anyName/>
               <ref name="anything"/>
            </element>
            <attribute>
               <anyName/>
            </attribute>
            <text/>
         </choice>
      </zeroOrMore>
   </define>
   <define name="foreign-elements">
      <zeroOrMore>
         <element>
            <anyName>
               <except>
                  <nsName ns=""/>
                  <nsName ns="urn:speedata.de:2009/publisher/en"/>
                  <nsName ns="urn:speedata:2009/publisher/functions/en"/>
               </except>
            </anyName>
            <ref name="anything"/>
         </element>
      </zeroOrMore>
   </define>
   <define name="foreign-attributes">
      <zeroOrMore>
         <attribute>
            <anyName>
               <except>
                  <nsName ns=""/>
                  <nsName ns="urn:speedata.de:2009/publisher/en"/>
                  <nsName ns="urn:speedata:2009/publisher/functions/en"/>
               </except>
            </anyName>
         </attribute>
      </zeroOrMore>
   </define>
   <define name="foreign-nodes">
      <zeroOrMore>
         <choice>
            <ref name="foreign-attributes"/>
            <ref name="foreign-elements"/>
         </choice>
      </zeroOrMore>
   </define>

and then use

<element name="....">
  <interleave>
    <group>
     ....
    </group>
    <ref name="foreign-nodes" />
  </interleave>
</element>

to add the rules.

See Eric's book at http://books.xmlschemata.org/relaxng/relax-CHP-11-SECT-4.html

pgundlach commented 6 years ago

Implemented in version 3.1.16