|
Subject: conditional processing in templates From: "Jon Smirl" <jonsmirl@xxxxxxxxxxxx> Date: Thu, 22 Jul 1999 00:49:10 -0400 |
I'm working on some forms processing code. Sometimes my display of a field
needs a label and sometimes it does not.
So I tried to write a template like this:
<xsl:template mode="display" match="*[@type='date']">
<xsl:attribute
name="onclick">buildEdit(this);popup('/cal_frame.html',400,270)</xsl:attribu
te>
<xsl:attribute name="title"><xsl:value-of
select="local-part()"/></xsl:attribute>
<xsl:if test="$label=1">
<xsl:value-of select="local-part()"/>:
</xsl:if>
<xsl:value-of select="."/>
</xsl:template>
.. repeated for many variable types...
And then call it with:
<xsl:template match="employee">
<xsl:variable name="label">1</xsl:variable>
<table width="100%" border="1">
<tr>
<td><xsl:apply-templates mode="display" select="First"/></td>
<td><xsl:apply-templates mode="display" select="Last"/></td>
</tr>
</table>
</xsl:template>
But this doesn't work because $label would be a side effect.
Can this be done without duplicating the first template, one for labels and
one without?
Thank for the help,
Jon Smirl
jonsmirl@xxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Shakespeare 2.00 available, Jon Bosak | Thread | Re: conditional processing in templ, David Carlisle |
| Shakespeare 2.00 available, Jon Bosak | Date | Re: Embedding HTML tags into XML, Miloslav Nic |
| Month |