Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Help? - xsl if statement

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 4/13/2008 1:28:00 PM

Julie Smith wrote:
> I'm trying to iterate through a collection and list them in a table 
> going horizontally, not vertically.
> Example of what i've currently got, but not working:
> 
> <xsl:variable name="columns" select="5"/>
> <table>
> <xsl:for-each select="//People">
>  <xsl:if test="(position() mod $columns) = 0"><tr></xsl:if>
>   <td>
>    <xsl:value-of select="@name"/>
>   </td>
>  <xsl:if test="(position() mod $columns) = 0"></tr></xsl:if>
> </xsl:for-each>
> </table>


You need to use a different approach, like this:
  <table>
   <xsl:for-each select="//People[position() mod $columns = 0]">
     <tr>
       <xsl:for-each select=". | following-sibling::People[position() 
&lt; $colums]">
         <td>
           <xsl:value-of select="@name"/>
         </td>
       </xsl:for-each>
     </tr>
   </xsl:for-each>
  </table>

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent