xsl-list
[Top] [All Lists]

RE: RE: How to implement an array

2003-02-12 15:02:58
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[(_at_)date[contains(.,$monthname)]])">
            <xsl:text>&#160;</xsl:text><!-- nbsp -->
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates
                select="$events/event[(_at_)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[(_at_)date[contains(.,$monthname)]]"/>
<xsl:if test="not($events/event[(_at_)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(_at_)mulberrytech(_dot_)com
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