RE: RE: [xsl] How to implement an array

Subject: RE: RE: [xsl] How to implement an array
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Feb 2003 17:02:58 -0500
At 04:39 PM 2/12/2003, I wrote:
<xsl:template match="events">
  <xsl:variable name="events" select="."/>
  <!-- bind the current node to a variable so we can get it back
       after we change context -->
  <tr>
    <xsl:for-each select="$months">
      <xsl:variable name="monthname" select="@name"/>
      <td>
        <xsl:choose>
          <xsl:when
             test="not($events/event[@date[contains(.,$monthname)]])">
            <xsl:text>&#160;</xsl:text><!-- nbsp -->
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates
                select="$events/event[@date[contains(.,$monthname)]]"/>
          </xsl:otherwise>
        </xsl:choose>
      </td>
    </xsl:for-each>
  </tr>
</xsl:template>

Of course, looking now at my own code I can see the xsl:choose could just as well be:


<xsl:apply-templates
  select="$events/event[@date[contains(.,$monthname)]]"/>
<xsl:if test="not($events/event[@date[contains(.,$monthname)]])">
  <xsl:text>&#160;</xsl:text><!-- nbsp -->
</xsl:if>

Note: I do not, myself, have obsessive-compulsive disorder. But living in my brain is someone who does.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread