Technologies XML / DocBook / Personnaliser DocBook / Étendre DocBook 5 / Étendre DocBook avec MathML et SVG

(Extrait de « DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren » de Thomas Schraitle)

Pour utiliser MathML et SVG ensemble, combinez les étapes des sections précédentes et créez un fichier de personnalisation (par exemple dbsvg-mathml.svg) contenant les deux. L’exemple suivant présente le résultat.

Exemple : Fichier de personnalisation pour DocBook avec SVG et MathML

<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<include href="docbook.rng">
  <define name="db._any.svg">
    <externalRef href="svg11.rng"/>
  </define>
  <define name="db._any.mml">
    <externalRef href="mathml2.rng"/>
  </define>        
  <define name="db._any">
    <element>
      <anyName>
        <except>
          <nsName ns="http://docbook.org/ns/docbook"/>
          <nsName ns="http://www.w3.org/1999/xhtml"/>
          <nsName ns="http://www.w3.org/2000/svg"/>
          <nsName ns="http://www.w3.org/1998/Math/MathML"/>
         </except>
       </anyName>
       <zeroOrMore>
         <choice>
           <attribute>
             <anyName/>
           </attribute>
           <text/>
           <ref name="db._any"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
</include>
</grammar>

default namespace db = "http://docbook.org/ns/docbook"
namespace svg = "http://www.w3.org/2000/svg"
namespace mml = "http://www.w3.org/1998/Math/MathML"
namespace html = "http://www.w3.org/1999/xhtml"

include "docbook.rnc" {
  db._any.svg = external "svg11.rnc"
  db._any.mml = external "mathml2.rnc"
  db._any =
    element * - (db:* | html:* | svg:* | mml:*) {
      (attribute * { text }
       | text
       | db._any)*
   }
}

  

haut de page