[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] DTD customizations for XIncludes: How to addXIncludes support for row in tbody?
Hi Paul, We have just been working on this ourselves, because we are working out how to use the XSL stylesheets with our SGML source. It involves converting SGML to XML using osx, then applying the stylesheets. However, the XSL processor we are using, xsltproc, needs to use Xincludes to bring in <programlisting>s from external files. So we followed Bob Stayton's book, as you have. > I try to adapt the dtd based on http://www.sagehill.net/docbookxsl/ValidXinclude.html. The problem for us is changing the SGML mark-up, which looks like this: <programlisting><inlinemediaobject> <imageobject> <imagedata format="linespecific" fileref="filename.ext"> </imageobject> </inlinemediaobject> </programlisting> To Xinclude format: <programlisting> <xi:include href="filename.ext" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"/> </programlisting> We did this by running our XML source through a small XSL stylesheet: <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- Copies the whole tree, with attributes. --> <xsl:template match="node()|@*"> <xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy> </xsl:template> <!-- Changes markup for programlisting. --> <xsl:template match="programlisting"> <!-- Get the filename --> <xsl:variable name="fref" select="inlinemediaobject/imageobject/imagedata/@fileref"/> <!-- Create the opening tag --> <programlisting> <!-- Write all pre-filename Xinclude markup --> <xsl:text disable-output-escaping="yes"><xi:include href="</xsl:text> <!-- Write the filename --> <xsl:value-of select="substring($fref, 4)"/> <!-- Write all post-filename Xinclude markup --> <xsl:text disable-output-escaping="yes">" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"/></xsl:text> <!-- Create the closing tag. --> </programlisting> </xsl:template> </xsl:stylesheet> You can probably do something similar for <row role="include-this"> elements in your code. However, in your situation, I would simply define an entity for each row that you want to include, and then include the entity file in each document. For example, in your code, you would have something like this: <table> <title>The Blahs</title> <tgroup cols="3"> <tbody> <row><entry>Local Blah</entry></row> <row><entry>&blah_text_1;</entry></row> <row><entry>Local Blah</entry></row> </tbody> </tgroup> </table> At the top of your document, in the DTD declaration, you would have a line like this: <!ENTITY % my_entities SYSTEM "my_entities.sgml"> %my_entities; This lets you put all your entities into a separate file, which any document can have access to. The contents of the my_entities.sgml file would look something like this: ... <!entity blah_text_1 "Universal Blah"> ... Hope that helps, Cheerio! Bob > > I'am a small scale docbook user with an xsl customization layer but I have no experience customizing the dtd. > > I'm responsible for the publishing proces and my writers are reusing rows in different tables. > > I got the publishing proces to work based on: > <tbody> > <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="reusefile.xml#xpointer(//table[@id='reuseID']/tgroup/tbody/*)" /> > <row> > ... > </row> > </tbody> > > Is there a "right" or better way to reuse row-level information? > > But I do this in an ugly way by preprocessing the content file with ant and regular expressions. <row role="reuse">reuseID</row> > This preprocessing-step I would like te eliminate. > > > So what I think needs to be done is to change the dtd so that an editor accepts and proposes the xi:include within tbody. > > The problem I have is that I do not find a parameter entity like "local.tbody. .." that I can overrule. > > In what direction should I look for a solution? > > Thanks, > > Paul > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: email@example.com > For additional commands, e-mail: firstname.lastname@example.org -- --------------------------- Robert McIlvride, Cogent Real-Time Systems, Inc. email@example.com (888) 628-2028 www.cogent.ca