Re: [xsl] How to determine the 'first' time a template ha

Subject: Re: [xsl] How to determine the 'first' time a template ha
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Tue, 20 Mar 2001 13:54:57 +0100

>   I would include the <script src=.../> automatically in the transform 
>   and not in the named template.  I realize that it may cause the script 
>   to be included when it doesn't need to be, but doing so makes the XSLT 
>   code simplier.

I did this by having a check, wether any such element exists and have
the main-template output the required <script/> like:

<xsl:template match="/">

  <xsl:if test="count(//foo) &gt; 0">
    <script src="foo.js" />
  </xsl:if>

  <xsl:apply-templates />
</xsl:template>

<xsl:template match="foo">
  <!-- foo output -->
</xsl:template>

Cu,
    Goetz.

Attachment: pgp00005.pgp
Description: PGP signature

Current Thread