• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xsl - need to select on attribute and limit output

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to modify the following xsl code to limit the output to only 4 records. The childnumber method worked when I was not stripping off the article id = '_0'. Since adding that, I get only three lines of information.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:for-each select="moreovernews/article[@id != '_0']">
<xsl:choose>
<xsl:when expr="childNumber(this) > 4"></xsl:when>
<xsl therwise>
<tr><td width='100%' colspan='2'><a style='color: #000080; font-size: 12pt; font-weight: bold' ><xsl:attribute name="href"><xsl:value-of select="url"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:value-of select="headline_text"/></a></td></tr>
<tr><td width='10%'></td><td width='90%'><a><xsl:attribute name="href"><xsl:value-of select="document_url"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:value-of select="source"/></a>
<a><xsl:attribute name="href"><xsl:value-of select="access_registration"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:value-of select="access_status"/></a>
<xsl:value-of select="harvest_time"/> GMT</td></tr>

</xsl therwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>



I think that I need to use templates, and then use a parameter to count the records output, but then I do not know how to filter the id attribute.

Thanks in advance for any help.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic