Hi
I have an xml page which is database driven (asp). In my xsl page I only want to display the first 5 articles. Something like:
--xml page
<page>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
--etc
</page>
--xsl - this bit only wants to select the first 5 articles although the code I've put doesn't work
<xsl:for-each select="/page/article[count = 5]">
<xsl:value-of select="title" />
</xsl:for-each>
If you get my drift...
I have found an example which works with the working draft xsl namespace, but it won't work with the namespace I'm using (<xsl:stylesheet version="1.0" xmlns:xsl=" and I don't really want to go backwards and use the working draft. This code is:
<xsl:choose>
<xsl:when expr="childNumber(this) > 5"></xsl:when>
<xsltherwise>
<xsl:value-of select="/page/article/title" />
</xsltherwise>
</xsl:choose>
Grateful in advance for any comments/suggestions...
I have an xml page which is database driven (asp). In my xsl page I only want to display the first 5 articles. Something like:
--xml page
<page>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
<article>
<title>Test</title>
<body>blah blah blah labhabl hb</body>
</article>
--etc
</page>
--xsl - this bit only wants to select the first 5 articles although the code I've put doesn't work
<xsl:for-each select="/page/article[count = 5]">
<xsl:value-of select="title" />
</xsl:for-each>
If you get my drift...
I have found an example which works with the working draft xsl namespace, but it won't work with the namespace I'm using (<xsl:stylesheet version="1.0" xmlns:xsl=" and I don't really want to go backwards and use the working draft. This code is:
<xsl:choose>
<xsl:when expr="childNumber(this) > 5"></xsl:when>
<xsltherwise>
<xsl:value-of select="/page/article/title" />
</xsltherwise>
</xsl:choose>
Grateful in advance for any comments/suggestions...