This might help, from the XSL FAQ: http://www.dpawson.co.uk/xsl/sect2/sect21.html
simon
xsl:import vs xsl:include
Tony Graham
There are differences. Stylesheets that you reference with xsl:import have a lower "import precedence" than the importing stylesheet, whereas stylesheets you reference with xsl:include are almost completely treated as if you'd copied the referenced file and pasted it into your stylesheet at that point.
For example, if you had template in both the main and the referenced stylesheet with the same match pattern. With xsl:import, you wouldn't get a conflict because the main stylesheet has higher "import precedence" (plus there's rules about import precedence of multiple imported stylesheets). With xsl:include, you would get an error because the template in the referenced stylesheet is treated as if it were in the main stylesheet, and two templates matching the same pattern will cause an error. Mike Kay added: The differences are to do with the handling of precedence if several stylesheets declare the same object.
I quite agree that it seems crazy to have two such strongly overlapping features: it looks from the outside like a classic committee compromise, and frankly the reason I delayed implementing it for so long in SAXON was that I thought any sensible committee (is there such a beast?) would rationalise the spec in this area. My optimism seems to have been unfounded.
On Sunday, October 12, 2003, at 01:31 AM, Christian Jaeger wrote:
Hello
I'm using AxKit::XSP::PerForm for the first time.
- the included perform_html.xsl file is incomplete, it misses the following template:
<xsl:template match="file_upload">
<input type="file" name="[EMAIL PROTECTED]|[EMAIL PROTECTED]|index}">
<xsl:if test="@accept or accept/text()">
<xsl:attribute name="accept"><xsl:value-of select="@accept|accept"/></xsl:attribute>
</xsl:if>
</input>
<xsl:apply-templates select="error"/>
</xsl:template>
- I have problems with xsl:import.
Ok, there are 3 ways using perform_html.xsl:
(1) using it directly: cp perform_html.xsl perfhtmlcopy.xsl; remove comment around the default template, and put above file_upload template into perfhtmlcopy.xsl. This works.
(2) using an own stylesheet.xsl, and <xsl:include href="perform_html.xsl"/>. This works as well.
(3) using an own stylesheet.xsl, and <xsl:import href="perform_html.xsl"/>. This does not work, the html output looks like the perform_html.xsl would not have been seen at all.
No error in the logs, just these debug messages: ... LibXSLT match_uri: /xsl/perform_html.xsl LibXSLT open_content_uri: /xsl/perform_html.xsl Style Provider Override: Apache::AxKit::Provider::File decoding from UTF-8 [req] File Provider given $r: /home/dav/Site1_dev/xsl/perform_html.xsl encoding to UTF-8 [LibXSLT] performing transformation ...
So libxslt fetches the xsl:import'ed sheet, but then does just as it has not seen it at all and only applies the templates from the parent sheet.
This is my parent sheet: is the default template a problem?:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="/xsl/perform_html.xsl"/>
<xsl:output method="html" encoding="iso-8859-1"/>
<xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="file_upload">
<input type="file" name="[EMAIL PROTECTED]|[EMAIL PROTECTED]|index}">
<xsl:if test="@accept or accept/text()">
<xsl:attribute name="accept"><xsl:value-of select="@accept|accept"/></xsl:attribute>
</xsl:if>
</input>
<xsl:apply-templates select="error"/>
</xsl:template>
<xsl:template match="error"> <span class="form_error">FFF <xsl:value-of select="."/></span> </xsl:template>
</xsl:stylesheet>
Thanks for any enlightment christian.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- anti-spam: do not post this address publicly www.simonwoodside.com -- 99% Devil, 1% Angel
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]