[xsl] Creating External Generic XSL functions file

Subject: [xsl] Creating External Generic XSL functions file
From: Nick White <nick.white@xxxxxxxxxxx>
Date: Thu, 10 Jan 2002 11:02:57 +1100
Hi,
My problem is as such;
I have a few functions within my stylesheet(s) which are called within my
stylesheet(s).

Eg. Template Function.
<xsl:template name="br-replace">
   <xsl:param name="word"/>
<!-- </xsl:text> on next line on purpose to get newline -->
   <xsl:variable name="cr" select ="'&#xA;'"></xsl:variable>
   <xsl:choose>
   <xsl:when test="contains($word,$cr)">
       <xsl:value-of select="substring-before($word,$cr)"/>
       <br/>
       <xsl:call-template name="br-replace">
         <xsl:with-param name="word"
             select="substring-after($word,$cr)"/>
       </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="$word"/>
   </xsl:otherwise>
  </xsl:choose>
</xsl:template> 

and is called within stylesheet(s) by:
<xsl:call-template name="br-replace">
<xsl:with-param name="word" select="root/parent/element"/>
</xsl:call-template>

What I want to do is to write a "Consolidated.xsl" XSL file containing all
my generic xsl functions that are used in more than one xsl file.
Basically I want to know what needs to be in the Consolidated.xsl (obviously
apart from the functions) and how you call/include the Consolidated.xsl
functions in the stylesheet(s)?

Thank-you.

Regards,
Nic White


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


Current Thread