Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL question

Status
Not open for further replies.

transparent

Programmer
Sep 15, 2001
333
GB
I have the following xsl, which I need to modify so that it will return only 3 instances of content/story. How do I do this?

<?xml version=&quot;1.0&quot;?>
<xsl:template xmlns:xsl=&quot;
<table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;>
<tr><td>

<xsl:for-each select=&quot;content/story&quot; order-by=&quot;- file&quot;>

<xsl:if test=&quot;published[.!value()='true']&quot;>
<p class=&quot;headline&quot;>

<a>
<xsl:attribute name=&quot;href&quot;>
<xsl:value-of select=&quot;folder&quot; />/<xsl:value-of select=&quot;page&quot; />
</xsl:attribute>
<xsl:value-of select=&quot;headline&quot; />
</a>

</p>
<p class=&quot;blurb&quot;><xsl:value-of select=&quot;folder&quot; />: <xsl:value-of select=&quot;blurb&quot; /> </p>
</xsl:if>

</xsl:for-each>

</td></tr>
</table>


</xsl:template>
 
<xsl:stylesheet xmlns:xsl=&quot; version=&quot;1.0&quot;>
<xsl:template match=&quot;/&quot;>
<table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td>
<xsl:for-each select=&quot;content/story[published[.!value()='true']]&quot;>
<xsl:if test=&quot;position < 3&quot;>
<xsl:sort select=&quot;file&quot; order=&quot;descending&quot; />
<p class=&quot;headline&quot;>
<a>
<xsl:attribute name=&quot;href&quot;>
<xsl:value-of select=&quot;folder&quot; />
<xsl:text>/</xsl:text>
<xsl:value-of select=&quot;page&quot; />
</xsl:attribute>
<xsl:value-of select=&quot;headline&quot; />
</a>
</p>
<p class=&quot;blurb&quot;><xsl:value-of select=&quot;folder&quot; />: <xsl:value-of select=&quot;blurb&quot; /> </p>
</xsl:if>
</xsl:for-each>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top