On Friday 08 February 2002 20:55, you wrote:
> I've been trying to use XInclude to combine two XML documents before I
> process them with my stylesheet.  I have searched the mailing list and the
> documentation and couldn't find any references to a working AxKit, LibXML,
> XInclude example.  However, I did find some references on axkit-users
> saying that it could be done.  Any help would be greatly appreciated.

I have never used Xinclude, but I use the document() function of XPath quite 
often. I'll modify your example: (note now these are two examples in one)

## index.xml
<?xml version="1.0"?>
<?xml-stylesheet href='/xsl/ostore/test.xsl' type="text/xsl"
title="ostore"?>

<document>
    <parent>
        <product href="/xml/product/RYAN/test.xml" />
    </parent>
</document>

## test.xml
<?xml version="1.0"?>

<child>
    <grand_child>alpha</grand_child>
    <grand_child>beta</grand_child>
    <grand_child>gamma</grand_child>
</child>

## test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" version="1.0" indent="yes"
encoding="iso-8859-1"/> <xsl:template match="/">
<html>
<body>
    <h1>TEST</h1>
    <pre>
        <xsl:comment>alternative one: always the same document included
        </xsl:comment>
        <xsl:apply-templates select="document('/xml/product/RYAN/test.xml')"/>

        <xsl:comment>alternative two: included document set by xml
        (xsl:template match="product" below belongs to this method as well)
        </xsl:comment>
        <xsl:apply-templates/>
    </pre>
</body>
</html>
</xsl:template>

<xsl:template match="product">
        <xsl:apply-templates select="document(@href)"/>
</xsl:template>


<xsl:template match="*">
        <xsl:copy select=".">
                <xsl:copy-of select="@*"/>
                <xsl:apply-templates/>
        </xsl:copy>
</xsl:template>

<xsl:template match="text()">
        <xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>

-- 
CU
        Joerg

PGP Public Key at http://ich.bin.kein.hoschi.de/~trouble/public_key.asc
PGP Key fingerprint = D34F 57C4 99D8 8F16 E16E  7779 CDDC 41A4 4C48 6F94

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to