This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Result count in a for-each with an embedded if
- To: XSL-List at lists dot mulberrytech dot com
- Subject: [xsl] Result count in a for-each with an embedded if
- From: "Tim" <xsl at cheekymail dot net>
- Date: 19 Jun 2001 15:56:19 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi,
Tring to do a count of the results of the following snip:
<xsl:template match="articles">
<xsl:for-each select="article">
<xsl:if test="contains(translate
(detail,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),trans
late
($keyword,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'))">
<xsl:value-of select="normalize-space(title)"/>
</xsl:if>
</xsl:for-each>
There were XX articles found.
</xsl:template>
Need to return the XX value.
I can't find a way of putting the contains test into the for-each
select so I could use the position()(?).
Ideas would be appreciated.
Thanks,
Tim.
Example xml:
<articles>
<article ID="article1">
<title>
A Title
</title>
<detail>
Some detail on the subject.
</detail>
</article>
<article ID="article2">
.........
</article>
..........
</articles>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list