-
February 1st, 2005, 10:06 AM
#1
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?
I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.
-
February 3rd, 2005, 06:30 PM
#2
Hi Guus,
I hope this can help you...you've been waiting awhile so I thought I'd try to send you in the right direction...
www.ltg.ed.ac.uk/xml2001/ materials/tutorial2/tutorial2.ppt -
www.xml.com/pub/a/2000/09/13/xslt/ - 41k -
www.jguru.com/faq/subtopic.jsp?topicID=270742 - 24k
a shot in the dark...if you know what I mean.
Eg
-
February 3rd, 2005, 09:03 PM
#3
Thanks, Ega, but I had it figured out. count(*) did the trick
I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.
-
February 3rd, 2005, 10:24 PM
#4
Good !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|