include_1-input.xml
<?xml version="1.0"?>
<products>
<product
id="p1" name="Delta" price="3250" stock="4"/>
<product
id="p2" name="Golf" price="1000" stock="5"/>
<product
id="p3" name="Alpha" price="1200" stock="19"/>
<product
id="p4" name="Foxtrot" price="1500" stock="5"/>
<product
id="p5" name="Tango" price="1225" stock="3"/>
</products>
include_1-stylesheet.xsl
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:include
href="include_extra.xsl"/>
<xsl:output
indent="yes"/>
<xsl:template
match="/">
<PRODUCTS>
<xsl:apply-templates/>
</PRODUCTS>
</xsl:template>
</xsl:stylesheet>
include_1-stylesheet-extra.xsl
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template
match="product">
<PRODUCT
id="{@id}" price="{@price}" stock="{@stock}"/>
</xsl:template>
</xsl:stylesheet>
include_1-output.xml
<?xml version="1.0" encoding="UTF-8"?>
<PRODUCTS>
<PRODUCT
id="p1" price="3250" stock="4"/>
<PRODUCT
id="p2" price="1000" stock="5"/>
<PRODUCT
id="p3" price="1200" stock="19"/>
<PRODUCT
id="p4" price="1500" stock="5"/>
<PRODUCT
id="p5" price="1225" stock="3"/>
</PRODUCTS>
Templates in including and included stylesheets have are equal if they match with same priority. In that case the last one will win out.
Updated 2009-03-19