This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Conditional counting
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Conditional counting
- From: "Hunsberger, Peter" <Peter dot Hunsberger at stjude dot org>
- Date: Fri, 12 Oct 2001 09:04:13 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
<snip>
>There are several possibilities, depending on your exact problem.
>If your extension methods produce a node-set with node for each table row,
>as yoursecond template suggests, you can try
>
> <xsl:if test="$gunk = 'x''">
> <xsl:variable name="result" select="myExt.method1(*)"/>
> <table border="1">
> <xsl:apply-templates select="$result" mode="x" />
> </table>
> <xsl:value-of select="count($result)"/> rows generated.
> </xsl:if>
> <xsl:if test="$gunk != 'x'">
> <table border="1">
> <xsl:variable name="result" select="myExt.method2(*)"/>
> <xsl:apply-templates select="$result" mode="x" />
> </table>
> <xsl:value-of select="count($result)"/> rows generated.
> </xsl:if>
>
>Note that you'll have to distribute a lot of stuff into the
>conditional statements, because of the way variables are scoped.
</snip>
Yes, that thought had occurred to me but I ruled it out for exactly that
reason.
<snip>
>Be warned this will also count rows of nested tables, you may have to
>fiddle with the expression a bit if you experience difficulties
>(xx:node-set($result)/tr might work, but i'm not sure).
</snip>
There won't be nested tables so either case should work. Jeni also
suggested this solution, it seem like the most viable.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list