Counting related entries
This is an open discussion with 4 replies, filed under XSLT.
Search
Nb. Just to clarify when I say it doesnt work
<xsl:value-of select="chillers"/>
will work so it seems as though the variable wont be assigned
I just solved it ...
I had assigned the variable outside of a for loop... but I still feel there must be a simpler way to do a count maybe with a combined data source?
There are a couple of issues with your example, but without knowing the full picture of how you're iterating over the data, I can only give you more generic solutions to your problem.
Here's a method of counting nodes using xsl:key
: http://xpathr.com/view/4071524/
You don't have to do count()
using keys but this does make things a little simpler.
Hi Allen thanks for the reply! I didnt know about xpathr so that looks a great help
although I have it working, xsl:key does make things a lot simpler
thanks again for your reply
Create an account or sign in to comment.
I have 3 types
Products, Categories, Subcategories
Categories are related to subcategories by the parent field extension Products are related to Categories by a Tag list
I am trying to do a count of products under each category
I have a data source which outputs a list of each product and its category,
I then tried doing a count in XSLT,
Assigning that to a variable and using that
It doesnt work, anyway I feel there must be an easier way to acheive what I'm after any pointers?