lundi 29 juin 2015

How do I process 3 separate XSLT files from a single XML to a single output?

I have an XSLT file that works with an XML to process a HTML (currently using X-trans & Notepad++). What I want to do is split it into 3 files, The Header, the body and the footer.

So far I have tried to use xsl:import & xsl:include but whenever I try to process it says the file is not valid. I'm clearly missing something can anyone help?

Header XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
    <html lang="en-GB">
        <body style="font-family:'Praxis Com Light'; color:#632423; width:100%; font-size:14px !important;">


            <xsl:variable>variable1</xsl:variable>
            <xsl:variable>variable2</xsl:variable>
            <xsl:variable>variable3</xsl:variable>

            <div>Header</div>

        </body>
    </html>
</xsl:template>

Body XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
    <html lang="en-GB">
        <body style="font-family:'Praxis Com Light'; color:#632423; width:100%; font-size:14px !important;">


            <xsl:include href="Header.xsl"/>

            <xsl:variable>variable1</xsl:variable>
            <xsl:variable>variable2</xsl:variable>
            <xsl:variable>variable3</xsl:variable>

            <table>Main XSL file</table>

            <xsl:include href="Footer.xsl"/>


        </body>
    </html>
</xsl:template>

Footer XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
    <html lang="en-GB">
        <body style="font-family:'Praxis Com Light'; color:#632423; width:100%; font-size:14px !important;">


            <xsl:variable>variable1</xsl:variable>
            <xsl:variable>variable2</xsl:variable>
            <xsl:variable>variable3</xsl:variable>

            <p>Footer</p>


        </body>
    </html>
</xsl:template>

Diagram to help Illustrate

Aucun commentaire:

Enregistrer un commentaire