← Prev in month ← Prev in thread

Creating a Olink master document

From
Jens Stavnstrup <>
Date
2003-12-07T08:49:03+00:00
ID
Thread
Creating a Olink master document
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
← Prev in month ← Prev in thread