This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: Problem with XInclude
- From: Richard Barrington <rich_b_nz at clear dot net dot nz>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Wed, 20 Nov 2002 21:25:43 +1200
- Subject: Re: DOCBOOK-APPS: Problem with XInclude
- Reply-to: rich_b_nz at clear dot net dot nz
> I just tried to use XInclude in my DocBook/XML marked up book to
> include listings from external files into <programlisting> sections,
> but all I get out of
>
> <xi:include href="Test.php" parse="text" />
>
> is
>
> <xi:include></xi:include>
>
> in the output and
>
> No template matches xi:include in programlisting.
>
> as a warning from Saxon 6.5.2.
>
>--
> Sebastian Bergmann
Saxon 6.5.2 doesn't do xinclude "out of the box". You cantry the xincluder plugin
from http://xincluder.sourceforge.net/ or maybe you can use something like this
stylesheet first:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- initial generator -->
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<!-- simply copy everything -->
<xsl:template match="@*|*|text()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
<!-- base reference for xincludes
a smarter person may be able to do without it -->
<xsl:param name="basedir" select="."/>
<!-- resolve the xi:includes in leau of a real xincluder -->
<xsl:template match="xi:include">
<xsl:apply-templates select="document(concat($basedir,../@xml:base,@href))"/>
</xsl:template>
</xsl:stylesheet>