XML / XSLT question (how to count elements?)
This should be an easy question for someone who's a little more experienced in XML/XSLT than me. :) Please help me out!
I'm displaying an object (java graph) that needs a varying number of parameters. Somewhat reduced, my code looks like this:
Code:
<xsl: if test="AnaType='bargraph'">
<applet archive="/java/Qgraphs.jar"
code="QBarGraph.class
width="480" height="300">
<xsl:for-each select="AnaParam">
<param>
<xsl:attribute name="name"<xsl:value-of select="Label"/></xsl:attribute>
<xsl:attribute name="value"<xsl:value-of select="Value"/></xsl:attribute>
</param>
</xsl:for-each>
</xsl:if>
My problem is this: if I have a large number of param's, the (static) height of 300 pixels isn't large enough. I'd like to have the '300' in line 4 replaced by something that'll calculate the height dynamically, depending on the number of AnaParam elements available. Something like height=basevalue+increment(amountofAnaParams) would be ideal.
Taking it one step further (hey, while you're at it ;) ), this would be calculated only if there's a AnaParam with label 'orientation' and value 'vertical' - otherwise, a static value of 300 would suffice.
Anyone?