Q:

Why won't relative path work for xsl:include?

I have a XSL file, which converts to PDF.  On the top of this page, I have a very long CSS style such as
<xsl:attribute-set name="Header">
    <xsl:attribute name="font-size">
        <xsl:value-of select="$font-size"/>
    </xsl:attribute>
    <xsl:attribute name="font-weight">bold</xsl:attribute>
    <xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set>
...

It takes a long time to render so that I copy these into a new page (PDF_style.xsl) in another location.  Then I use
<xsl:include href="../allStyles/PDF_style.xsl"/>

But when I test it, the system says it couldn't file this file location!
Note: allStyles is the folder I store every stylesheet files and the path is a correct one.
Is <xsl:include href="..." /> a correct way to link an external file?  Or do I have to use something else?

A:

A relative path for xsl:include/@href or xsl:import/@href is resolved against the directory of the XSLT file that does the including or importing.
So, if your XSLT file is
/xslt/my.xsl

then the PDF_style.xsl file must be here:
/allStyles/PDF_style.xsl

in order for
<xsl:include href="../allStyles/PDF_style.xsl" />

to be correct in /xslt/my.xsl.

