I am trying to recall an XSL snippet that will check to see if a class has all students with the same name. Yes, then (do something like) type "all last names are the same" else print "all last names are not the same."
No matter what to print. I'm just trying to find the right logic for him.
Here is my XML example:
<root> <class name="Physics"> <student> <firstname>John</firstname> <lastname>Doe</lastname> <age>21</age> </student> <student> <firstname>Mary</firstname> <lastname>Doe</lastname> <age>21</age> </student> <student> <firstname>Ralph</firstname> <lastname>Doe</lastname> <age>21</age> </student> </class> <class name="Math"> <student> <firstname>John</firstname> <lastname>Doe</lastname> <age>21</age> </student> <student> <firstname>Mary</firstname> <lastname>Doe</lastname> <age>21</age> </student> <student> <firstname>Tee</firstname> <lastname>Rex</lastname> <age>21</age> </student> </class> </root>
Therefore, for the physics class, he will print "all last names are the same." And for the math class, he will print "all the last names are not the same."
(This is not my real XML, because it was irreducible to a smaller problem, so instead I made this XML to represent my problem)
Any help would be greatly appreciated.
Regards, Shobhit
source share