Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 732857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:11:24+00:00 2026-05-14T07:11:24+00:00

I have a RSS feed i need to display in a table (its clothes

  • 0

I have a RSS feed i need to display in a table (its clothes from a webshop system). The images in the RSS vary in width and height and I want to make a table that shows them all. First off i would be happy just to show all of the items in 3 columns, but further down the road i need to be able to specify through a parameter the amount of columns in my table. I run into a problem showing the tr tag, and making it right, this is my Code so far:

 <xsl:template match="item">
    <xsl:choose>      
      <xsl:when test="position() mod 3 = 0 or position()=1">
        <tr>
          <td>
            <xsl:value-of select="title"/>
          </td>
        </tr>
        </xsl:when>
      <xsl:otherwise>
        <td>
          <xsl:value-of select="title"/>
        </td>
      </xsl:otherwise>
    </xsl:choose>    
  </xsl:template> 

In RSS all “item” tags are on the same level in the xml, and thus far i need only the title shows. Thr problem seems to be that i need to specify the start tag as well as the end tag of the tr element, and cant get all 3 elements into it, anyone know how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:11:25+00:00Added an answer on May 14, 2026 at 7:11 am

    Easy when you step back a bit. Split the problem into smaller parts.

    <xsl:param name="numColumns" select="3" />
    
    <xsl:template match="channel">
      <table>
        <!-- all items that start a column have position() mod x = 1 -->
        <xsl:apply-templates 
           select="item[position() mod $numColumns = 1]" 
           mode="tr"
        />
      </table>
    </xsl:template>
    
    <xsl:template match="item" mode="tr">
      <tr>
        <!-- all items make a column: this one (.) and the following x - 1 -->
        <xsl:apply-templates 
          select=".|following-sibling::item[position() &lt; $numColumns]"
          mode="td"
        />
      </tr>
    </xsl:template>
    
    <xsl:template match="item" mode="td">
      <td>
        <!-- calculate optional colspan for the last td -->
        <xsl:if test="position() = last() and position() &lt; $numColumns">
          <xsl:attribute name="colspan">
            <xsl:value-of select="$numColumns - position() + 1" />
          </xsl:attribute>
        </xsl:if>
        <xsl:value-of select="title"/>
      </td>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an RSS feed from Zendesk (http://mysupport.zendesk.com/forums/some-path/posts.rss) that I need to render as
I have RSS feed link, but I need to obtain date from it. Then
I have a problem with Facebook fan page RSS feed. I need to get
I am planing to display Rss feed inside an Androind app I have this
I have an RSS feed reader with a table view. When I run my
I have a website that I need to create an RSS feed for. Is
I have RSS feed that I want to modify on fly, all I need
I need to approve/reject tweets from my Twitter feed, and display on our website.
I have an HTML structure that is being pulled from an RSS feed, and
I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.