Re: Dyanmicaly Determine Mode
Jonas Sicking <[email protected]> Thu, 25 Jan 2007 11:48:38 -0800
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Message-ID | <[email protected]> |
Scott wrote:
> Dynamically Determine Mode
>
> Is there a way in which I could specify which mode to use by passing it
> in through using a node in the xml
>
>
> My example is
>
> <xsl:apply-templates select="List/StoreCoupons" mode="<xsl:value-of
> select="List/Logos/mode"/>"> The two option would multicolumn and
> normal
> <xsl:with-param name="numCols" select="$numCols"/>
> <xsl:with-param name="nodes" select="List/StoreCoupons"/>
> </xsl:apply-templates>
>
>
> <xsl:template match="*" mode="multiColumn"></xsl:template>
> <xsl:template match="*" mode="normal"> </xsl:template>
An alternative to martins solution is to do something like:
<xsl:apply-templates select="List/StoreCoupons">
<xsl:with-param name="numCols" select="$numCols"/>
<xsl:with-param name="nodes" select="List/StoreCoupons"/>
</xsl:apply-templates>
<xsl:template match="StoreCoupons[../Logos/mode='multColumn']">
...
</xsl:template>
<xsl:template match="StoreCoupons[../Logos/mode='normal']">
...
</xsl:template>
/ Jonas