RE: [xsl] xsl:import or xsl:include or another alternative?

Subject: RE: [xsl] xsl:import or xsl:include or another alternative?
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Tue, 1 Jul 2003 08:21:31 -0600
> From: jim [mailto:xsl@xxxxxxxxxxxxxxxxx]
> Sent: Tuesday, July 01, 2003 7:22 AM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] xsl:import or xsl:include or another alternative?
> 
> Hi again,
> 
> I'm using the "w3.org/1999/XSL/Transform" namespace now and 
> could use some
> help. The PRODUCT template below is used many times and i'd 
> appreciate some
> info on how to use xsl:import or xsl:include so that i can 
> change it once
> and have it update all my XSL files.

Put the template into a separate stylesheet (say, product.xslt), then use
xsl:import or xsl:include in your other stylesheets to make it available:

<xsl:import href="product.xslt"/> 
<!-- or whatever the proper path is; this can be relative to the importing
stylesheet -->

The primary difference between import/include is how the processor applies
the rules of precedence: xsl:include would be the same as if you had pasted
the included code directly into the stylesheet.  So if you imported *and*
included templates with the same rule, the included template would be
selected to process the matching context node.  Also note that xsl:import
must appear as a top-level element before any other child elements, while
xsl:include may appear as a top-level element in any position.

hth,
b.

| brian martinez                           brian.martinez@xxxxxxxxxxx |
| lead gui programmer                                    303.357.3548 |
| cheap tickets, part of trip network                fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400           englewood, co 80111 |
| cendant travel distribution services   http://www.cheaptickets.com/ |

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread