This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
[docbook-apps] Creating a Olink master document
- From: Jens Stavnstrup <js at ddre dot dk>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Sun, 7 Dec 2003 09:55:20 +0100 (CET)
- Subject: [docbook-apps] Creating a Olink master document
- Reply-to: Jens Stavnstrup <js at ddre dot dk>
All,
In order to be able to create a Olink master document dynamically, I
use XInclude statements instead of Entities. However, the solution
seems to produce multiple namespace declarations. How do I get rid of
the extra namespace specfication ?
My document specification is defined in documents.xml, the stylesheet
in makeolinks.xsl
-------------
documents.xml
-------------
<?xml version="1.0"?>
<documents>
<directory dir="volume1">
<docinfo id="vol1">
</docinfo>
</directory>
<directory dir="volume2">
<docinfo id="vol2">
</docinfo>
</directory>
</documents>
-------------
makeolinks.xsl
--------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude"
version='1.1'
exclude-result-prefixes="#default xi">
<!--
Creates the olinks masterdatabase.
-->
<xsl:output method="xml" version="1.0" encoding="utf-8"
indent="yes"
doctype-system="targetdatabase.dtd"/>
<xsl:template match="documents">
<targetset>
<targetsetinfo></targetsetinfo>
<sitemap>
<dir name="..">
<xsl:apply-templates/>
</dir>
</sitemap>
</targetset>
</xsl:template>
<xsl:template match="directory">
<dir>
<xsl:attribute name="name">
<xsl:value-of select="@dir"/>
</xsl:attribute>
<xsl:apply-templates/>
</dir>
</xsl:template>
<xsl:template match="docinfo">
<document>
<xsl:attribute name="targetdoc">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:variable name="href">
<xsl:value-of select="@id"/>
<xsl:text>-target.db</xsl:text>
</xsl:variable>
<xi:include xmlns="http://www.w3.org/2001/XInclude" href="{$href}"/>
</document>
</xsl:template>
</xsl:stylesheet>
------------------
Resulting document
------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE targetset
SYSTEM "../schema/dtd/targetdatabase.dtd">
<targetset>
<targetsetinfo> This is the target database document used to create
cross-references between document in the NATO C3 Technical
Architecture.</targetsetinfo>
<sitemap>
<dir name="..">
<dir name="volume1">
<document targetdoc="vol1">
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" xmlns="http://www.w3.org/2001/XInclude" href="vol1-target.db"/>
</document>
</dir>
<dir name="volume2">
<document targetdoc="vol2">
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" xmlns="http://www.w3.org/2001/XInclude" href="vol2-target.db"/>
</document>
</dir>
</dir>
</sitemap>
</targetset>
Regards,
Jens
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.