[xsl] Conditional Formating

Subject: [xsl] Conditional Formating
From: David Vogt <dvogt@xxxxxxxxxxxxx>
Date: Tue, 2 Jan 2001 12:00:26 -0600
I need to do some conditional formatting.
I'm a couple apply-templates deep into the tree.  At that point, within the
test of a choose/when, I'd like to reference a attribute of the root of the
tree, or a element off of the root of the tree, or something else that would
be better.

so, my xml might look like this:

<CALENDAR MYFORMAT="WEEK">
 <MYFORMAT>WEEK</MYFORMAT>
 <MONTHS>
  <MONTH>
  </MONTH>
  <MONTH>
  </MONTH>
  ...
 </MONTHS>
</CALENDAR>

I'd like to have some xsl like this but it's not referencing the value of
the MYFORMAT correctly.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="html"/>

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match="/">

<xsl:apply-templates/>

<xsl:template match="CALENDAR">
 <xsl:apply-templates select="MONTHS">
 </xsl:apply-templates>
</xsl:template>

<xsl:template match="MONTHS">
 <xsl:apply templates select="MONTH">
 </xsl:apply-templates>
</xsl:template>

<xsl:template match="MONTH">
 <xsl:choose>
  <xsl:when test="MYFORMAT='WEEK'">
   <td>You selected myformat of type week.</td>
  </xsl:when>
 </xsl:choose>
</xsl:template>

Basically, how do I get the xsl:when test=... to work???

Thanks,
Dave

Mark Your Calendar! 
SilverSummit 2001, April 8-12, Walt Disney World Dolphin Hotel 
<http://www.silverstream.com/userconference>> 
SILVERSTREAM's eBUSINESS PLATFORM in action: Visit:
<http://www.CivicLife.com> 
This solution realizes the vision of a "Citizen-Centric Civic World" by
harnessing the Internet 
to enable personal, real-time interactions between citizens and their civic
institutions. 
To learn more about this and other SilverStream eBusiness solutions visit: 
<http://www.silverstream.com/customers>> 



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


Current Thread