Jump to content

JJK

Members
  • Posts

    2
  • Joined

  • Last visited

JJK's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thank you for your answers! I managed to solve my problem with the last aalbetski's sollution. Since I'm still relative new to xml/xsl (etc.) issues I had more complex sollution before these ones. Again it seems that the simpliest ones are the best ones as well. I have still something here to digest but any way I can now do what I wanted. Thanks again.And you were right boen_robot. Child is not a gender but I tried to create something similar to my code and I guess this was the bad addition to my example:) I just tried to add more variants to my example to emphasize the importance of the issue that the type is unknown and can vary.
  2. I have an XML similar structure like this <People> <Person> <type>Male</type> <vegetarian>False</vegetarian> </Person> <Person> <type>Female</type> <vegetarian>False</vegetarian> </Person> <Person> <type>Female</type> <vegetarian>True</vegetarian> </Person> <Person> <type>Male</type> <vegetarian>True</vegetarian> </Person> <Person> <type>Male</type> <vegetarian>False</vegetarian> </Person> <Person> <type>Child</type> <vegetarian>False</vegetarian> </Person><People> Now I want to group all types and count the variants. How many are vegetarian and how many are not. Then total amount of each types.I have manage to do the total counting and sorting between types but I don't know how to count types vegetarians and non-vegetarians for each type?Notice that in my XML there are more types which are unknown. So I cannot use hard coding for types.Output is something like this <TABLE><TR> <TD>Gender</TD> <TD>Vetarian</TD> <TD>Non-Vegetarian</TD> <TD>Total</TD></TR><TR> <TD>Male</TD> <TD>1</TD> <TD>2</TD> <TD>3</TD></TR><TR> <TD>Female</TD> <TD>1</TD> <TD>1</TD> <TD>2</TD></TR><TR> <TD>Child</TD> <TD>0</TD> <TD>1</TD> <TD>1</TD></TR></TABLE>
×
×
  • Create New...