[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: RE: DOCBOOK-APPS: Including Fragments of other DocBook Documents
We use libxml2/libxslt (xmllint, xsltproc). Included below a customization of DocBook XML V4.2 that * allow fragments to be included at section and chapter level * allow inclusion into some literal text elements * enable EBNF (in no way related to XInclude) Process include.xml like this: xmllint --valid --postvalid --xinclude include.xml or xsltproc --xinclude /usr/share/xml/docbook/xsl-stylesheets/html/docbook.xsl include.xml Kind regards Peter Ring Magnus Informatik A/S A Wolters Kluwer Company ---- include.xml ---- <?xml version="1.0"?> <!DOCTYPE section PUBLIC "-//MAGNUS//DTD DocBook XML V4.2-Based Variant V1.1//EN" "magnus-docbookx.dtd"> <!-- $Id: include.xml,v 1.3 2002/06/20 09:32:44 pri Exp $ --> <section> <title>Examples of XInclude</title> <para>Include with a bare name</para> <programlisting><![CDATA[<xi:include href="included.xml#included-section"> <xi:fallback>included.xml</xi:fallback> </xi:include>]]></programlisting> <xi:include href="included.xml#included-section"> <xi:fallback>included.xml</xi:fallback> </xi:include> <section> <title>Include with a child sequence.</title> <programlisting><![CDATA[<xi:include href="included.xml#/1/2"> <xi:fallback>included.xml</xi:fallback> </xi:include>]]></programlisting> <xi:include href="included.xml#/1/2"> <xi:fallback>included.xml</xi:fallback> </xi:include> </section> <section> <title>Include with a xpointer.</title> <programlisting><![CDATA[<xi:include href="included.xml#xpointer(/*/section)"> <xi:fallback>included.xml</xi:fallback> </xi:include>]]></programlisting> <xi:include href="included.xml#xpointer(/*/section)"> <xi:fallback>included.xml</xi:fallback> </xi:include> </section> <section> <title>Include as literal text</title> <programlisting><![CDATA[<xi:include href="magnus-docbookx.dtd" parse="text"> <xi:fallback>included.xml</xi:fallback> </xi:include>]]></programlisting> <programlisting><xi:include href="magnus-docbookx.dtd" parse="text"> <xi:fallback>magnus-docbookx.dtd</xi:fallback> </xi:include></programlisting> </section> </section> ---- included.xml ---- <?xml version="1.0"?> <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "docbookx.dtd"> <!-- $Id: included.xml,v 1.5 2002/06/20 09:33:25 pri Exp $ --> <section id="included-section"> <title>An included section</title> <para>Some text</para> <section> <title>A section with no id</title> <para>Some more text</para> </section> <section> <title>Another section with no id</title> <para>Yet more text</para> </section> </section> ---- magnus-docbook.dtd ---- <!-- Customised DocBook XML DTD Invocation: "-//MAGNUS//DTD DocBook XML V4.2-Based Variant V1.1//EN" $Id: magnus-docbookx.dtd,v 1.1 2002/04/11 09:01:15 pri Exp $ --> <!-- XInclude element http://www.w3.org/TR/2002/CR-xinclude-20020221/ --> <!ELEMENT xi:include (xi:fallback) > <!ATTLIST xi:include href CDATA #REQUIRED parse (xml|text) "xml" encoding CDATA #IMPLIED xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" > <!ELEMENT xi:fallback ANY > <!ATTLIST xi:fallback xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" > <!-- include as chapter --> <!ENTITY % local.chapter.class "|xi:include" > <!-- include as section --> <!ENTITY % local.section.class "|xi:include" > <!-- Content models that could use <include parse="text" ...> for including source code etc. verbatim --> <!ENTITY % programlisting.element "IGNORE"> <!ENTITY % literallayout.element "IGNORE"> <!ENTITY % screen.element "IGNORE"> <!-- EBNF hooks --> <!ENTITY % ebnf.inline.hook "|nonterminal" > <!ENTITY % ebnf.block.hook "|productionset|constraintdef" > <!-- DocBook XML "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" --> <!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" > %DocBookDTD; <!ELEMENT programlisting (%para.char.mix; | co | lineannotation | xi:include)*> <!ELEMENT literallayout (%para.char.mix; | lineannotation | co | xi:include)*> <!ELEMENT screen (%para.char.mix; | co | lineannotation | xi:include)*> <!-- EBNF declarations from http://www.oasis-open.org/docbook/xml/ebnf/1.0/dbebnf.dtd --> <!ELEMENT productionset ((%formalobject.title.content;)?, (production|productionrecap)+) > <!ATTLIST productionset %common.attrib; %role.attrib; > <!ELEMENT production (lhs, rhs, constraint*) > <!ATTLIST production %idreq.common.attrib; %role.attrib; > <!ELEMENT lhs (#PCDATA) > <!ATTLIST lhs %common.attrib; %role.attrib; > <!ELEMENT rhs (#PCDATA|nonterminal|lineannotation|sbr)* > <!ATTLIST rhs %common.attrib; %role.attrib; > <!-- Allowed to be an xpointer: you can point to non-terminals in --> <!-- other specifications. --> <!ENTITY % required-XLink-to-production-ID "def CDATA #REQUIRED" > <!ELEMENT nonterminal (#PCDATA) > <!ATTLIST nonterminal %common.attrib; %required-XLink-to-production-ID; %role.attrib; > <!-- Must be an IDREF: constraints identified in your spec must be --> <!-- represented in your spec. --> <!ENTITY % required-IDREF-to-constraintdef-ID "linkend IDREF #REQUIRED" > <!ELEMENT constraint EMPTY > <!ATTLIST constraint %common.attrib; %required-IDREF-to-constraintdef-ID; %role.attrib; > <!-- Must be an IDREF: you can only recap productions in your spec --> <!ENTITY % required-IDREF-to-production-ID "linkend IDREF #REQUIRED" > <!ELEMENT productionrecap EMPTY > <!ATTLIST productionrecap %common.attrib; %role.attrib; %required-IDREF-to-production-ID; > <!ELEMENT constraintdef (title, (%admon.mix;)) > <!ATTLIST constraintdef %idreq.common.attrib; %role.attrib; > ---- -----Original Message----- From: Paul Grosso [mailto:pgrosso@arbortext.com] Sent: 19. juni 2002 16:01 To: Sagar.Shah@ubsw.com; docbook-apps@lists.oasis-open.org Subject: Re: DOCBOOK-APPS: Including Fragments of other DocBook Documents <snip /> This is interesting to me. Can you please tell us what tool(s) you are using that have implemented XInclude? (The W3C XML Core WG is still looking for XInclude implementation experience, and it was not clear to me that there was any great amount of XInclude support out there yet, so any information would be of value.) paul
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC