Re: parametric xsl element values

Subject: Re: parametric xsl element values
From: David Allouche <david@xxxxxxxxxxxxxxxx>
Date: Mon, 21 Aug 2000 16:25:04 -0200 (GMT+2)
> I am trying to make the value of xsl:include parametric and come from the 
> xml data.  First the well, is it possible? if yes, how?

This is not possible not parametrize the <xsl:import> or <xsl:include>
elements anyhow.

If you want to apply different stylesheets depending on document content,
you can use modes.

For example, if you want to apply style1.xsl or style2.xsl from style.xsl,
you could define all templates in style1.xsl with mode="style1" (and use
the mode attribute too in all call-template and apply-templates) and all
templates in style2.xsl with mode="style2".

Then, you could have a style.xsl styelsheet that contains:

<xsl:include href="style1.xsl"/>
<xsl:include href="style2.xsl"/>

<xsl:template match="some pattern">
  <xsl:choose>
    <xsl:when test="some test">
      <xsl:apply-templates select="." mode="style1"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="." mode="style2"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

That is just to give you the picture, adapt this what your are actually
doing.

There may be a better way to do this, but this this is my solution.

Hope this helps.

                             -- David --


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


Current Thread