1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 2 xmlns:xt="http://www.jclark.com/xt" 3 extension-element-prefixes="xt" 4 version="1.0"> 5 6<!-- This stylesheet works with XT; for others use chunker.xsl --> 7 8<!-- ==================================================================== --> 9 10<xsl:template name="make-relative-filename"> 11 <xsl:param name="base.dir" select="'./'"/> 12 <xsl:param name="base.name" select="''"/> 13 14 <!-- XT makes chunks relative --> 15 <xsl:choose> 16 <xsl:when test="count(parent::*) = 0"> 17 <xsl:value-of select="concat($base.dir,$base.name)"/> 18 </xsl:when> 19 <xsl:otherwise> 20 <xsl:value-of select="$base.name"/> 21 </xsl:otherwise> 22 </xsl:choose> 23</xsl:template> 24 25<xsl:template name="write.chunk"> 26 <xsl:param name="filename" select="''"/> 27 <xsl:param name="method" select="'html'"/> 28 <xsl:param name="encoding" select="'ISO-8859-1'"/> 29 <xsl:param name="indent" select="'no'"/> 30 <xsl:param name="content" select="''"/> 31 32 <xsl:message> 33 <xsl:text>Writing </xsl:text> 34 <xsl:value-of select="$filename"/> 35 <xsl:if test="name(.) != ''"> 36 <xsl:text> for </xsl:text> 37 <xsl:value-of select="name(.)"/> 38 </xsl:if> 39 </xsl:message> 40 41 <!-- apparently XT doesn't support AVTs for method and encoding --> 42 <xsl:choose> 43 <xsl:when test="$method = 'xml'"> 44 <xt:document href="{$filename}" 45 method="xml" 46 indent="{$indent}" 47 encoding="ISO-8859-1"> 48 <xsl:copy-of select="$content"/> 49 </xt:document> 50 </xsl:when> 51 <xsl:when test="$method = 'text'"> 52 <xt:document href="{$filename}" 53 method="text" 54 indent="{$indent}" 55 encoding="ISO-8859-1"> 56 <xsl:copy-of select="$content"/> 57 </xt:document> 58 </xsl:when> 59 <xsl:otherwise> 60 <xt:document href="{$filename}" 61 method="html" 62 indent="{$indent}" 63 encoding="ISO-8859-1"> 64 <xsl:copy-of select="$content"/> 65 </xt:document> 66 </xsl:otherwise> 67 </xsl:choose> 68</xsl:template> 69 70</xsl:stylesheet> 71