it'sme
it'sme

Reputation: 551

processing more than one xhtml file using XSLT

I have two xhtml input files and need one xhtml output file using xslt. how to achieve with xslt?.

Please help me

thanks

Upvotes: 0

Views: 113

Answers (2)

Dimitre Novatchev
Dimitre Novatchev

Reputation: 243459

Using the XSLT document() function it is possible to work with (process) many XML documents by a single XSLT transformation.

Upvotes: 0

Andreas
Andreas

Reputation: 1250

The first file is used as usual, while the second (and any more) can be used via the XPath command "document()" directly or as a variable. The variable solution looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:variable name="file2" select="document('file2.xhtml')"/>
    <xsl:template match="/">
        <html>
            <head>
                <title>Use 2 input files</title>
        </head>
            <body>
                <p>File 1 <xsl:value-of select="."/></p>
                <p>File 2 <xsl:value-of select="$file2"/></p>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

Of course you have to complete "value-of select=" to point to the data you want.

Upvotes: 1

Related Questions