Subject: Re: importing text-source in a xsl-stylesheet
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 27 Aug 1999 15:50:06 +0100 (BST)
|
> Now I want to include a certain header (lika a javascript-block) in
> each of them (lets call it header.xsl).
You can do the following:
<!DOCTYPE xsl:stylesheet [
<!ENTITY header SYSTEM "header.txt">
]>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
result-ns="">
<xsl:template match="foo">
&header;
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
however note that
1) If your xsl engine uses a validating parser on the XSL file, you need
to add a SYSTEM entry to that DOCTYPE pointing at a a DTD that
matches the stylesheet you are using.
2) The header `text' file is still parsed as XML, so you still need to
be careful of quoting < and &.
3) This is using general XML features rather than an XSL include
mechanism, it is probably easier to put your header into a named
template in an xsl file and then use the XSL import mechanism to
include this into your stylesheets, then just access the header by
calling the named template.
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|