?
Solved

dunbar effect

Posted on 2002-04-26
1
Medium Priority
?
294 Views
Last Modified: 2006-11-17
I am using this for-each in my xsl to create a "dunbar" effect.

I know there is a way to do this using recursion.

Please help.

<xsl:template name="_table_data">
<xsl:for-each select="ProductAvailabilityResponse/ProductAvailability">
  <xsl:variable name="pos"><xsl:value-of select="position()"/></xsl:variable>
  <xsl:variable name="IsVerified"><xsl:value-of select="ProductLineItem/ProductInfo/IsVerifiedOffer"/></xsl:variable>
  <xsl:choose>    
    <xsl:when test="($pos mod 2) = 0">
      <tr class="Even">                  
        <td class="Even">    
          <xsl:value-of select="ProductLineItem/ContactInfo/CompanyName"/>              
        </td>        
        <td class="Even">
          <xsl:if test="$IsVerified='True' or $IsVerified='true' or $IsVerified='TRUE'">
            <image src="http://www.americaii.com/images/bf/ISCP.gif"/>
          </xsl:if>
        </td>    
        <td class="EvenBold">
          <xsl:value-of select="ProductLineItem/ProductInfo/ProductId"/>    
        </td>            
        <td class="Even">
          <xsl:value-of select="ProductLineItem/ProductInfo/ProductMfg"/>    
        </td>            
        <td class="Even" align="center">
          <xsl:value-of select="ProductLineItem/ProductInfo/ProductDC"/>    
        </td>            
        <td class="Even" align="right">
          <xsl:variable name="RawQty"><xsl:value-of select="ProductLineItem/ProductInfo/ProductQty"/></xsl:variable>
          <xsl:value-of select="format-number($RawQty,'###,###,###')"/>
        </td>
        <td class="Even" align="left">
          <xsl:value-of select="ProductLineItem/ProductInfo/Description"/>    
        </td>    
      </tr>
    </xsl:when>
    <xsl:otherwise>
      <tr class="Odd">                  
        <td class="Odd">
          <xsl:value-of select="ProductLineItem/ContactInfo/CompanyName"/>    
        </td>
        <td class="Odd">
          <xsl:if test="$IsVerified='True' or $IsVerified='true' or $IsVerified='TRUE'">
            <image src="http://www.americaii.com/images/bf/ISCP.gif"/>
          </xsl:if>
        </td>    
        <td class="OddBold">
          <xsl:value-of select="ProductLineItem/ProductInfo/ProductId"/>    
        </td>            
        <td class="Odd">
          <xsl:value-of select="ProductLineItem/ProductInfo/ProductMfg"/>    
        </td>            
        <td class="Odd" align="center">
          <xsl:value-of select="ProductLineItem/ProductInfo/ProductDC"/>    
        </td>            
        <td class="Odd" align="right">
          <xsl:variable name="RawQty"><xsl:value-of select="ProductLineItem/ProductInfo/ProductQty"/></xsl:variable>
          <xsl:value-of select="format-number($RawQty,'###,###,###')"/>
        </td>    
        <td class="Odd" align="left">
          <xsl:value-of select="ProductLineItem/ProductInfo/Description"/>    
        </td>    
      </tr>
    </xsl:otherwise>
  </xsl:choose>
</xsl:for-each>
</xsl:template>
0
Comment
Question by:jerelw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
b1xml2 earned 200 total points
ID: 6973091
<xsl:template name="_table_data">
<xsl:for-each select="ProductAvailabilityResponse/ProductAvailability">
<!--holding class value-->
<xsl:variable name="class">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">Even</xsl:when>
<xsl:otherwise>Odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--converting text to lower case-->
<xsl:variable
  name="IsVerified"
  select="translate(ProductLineItem/ProductInfo/IsVerifiedOffer,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<tr class="{$class}">                  
<td class="{$class}">
  <xsl:value-of select="ProductLineItem/ContactInfo/CompanyName"/>
 </td>        
<td class="{$class}">
  <xsl:if test="$IsVerified='true'">
    <image src="http://www.americaii.com/images/bf/ISCP.gif"/>
  </xsl:if>
</td>    
<td class="{$class}Bold">
  <xsl:value-of select="ProductLineItem/ProductInfo/ProductId"/>    
</td>            
<td class="{$class}">
  <xsl:value-of select="ProductLineItem/ProductInfo/ProductMfg"/>    
</td>            
<td class="{$class}" align="center">
  <xsl:value-of select="ProductLineItem/ProductInfo/ProductDC"/>    
</td>            
<td class="{$class}" align="right">
  <xsl:value-of select="format-number(ProductLineItem/ProductInfo/ProductQty,'###,###,###')"/>
</td>
<td class="{$class}" align="left">
  <xsl:value-of select="ProductLineItem/ProductInfo/Description"/>    
</td>    
</tr>
</xsl:for-each>
</xsl:template>

Regards,

Brandon Driesen
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question