我是 XML的新手,所以我希望你的帮助. 我有以下XML: ?xml version="1.0" encoding="UTF-8"? Students -Student Id="001" NamePeter/Name LastNameKohen/LastName -Courses -Course Id="01" NameC#/Name /Course -Course Id="02" NameJava/
我有以下XML:
<?xml version="1.0" encoding="UTF-8"?> <Students> -<Student Id="001"> <Name>Peter</Name> <LastName>Kohen</LastName> -<Courses> -<Course Id="01"> <Name>C#</Name> </Course> -<Course Id="02"> <Name>Java</Name> </Course> </Courses> </Student> -<Student Id="002"> <Name>Nick</Name> <LastName>Nikes</LastName> -<Courses> -<Course Id="02"> <Name>Java</Name> </Course> -<Course Id="03"> <Name>Oracle</Name> </Course> </Courses> </Student> -<Student Id="003"> <Name>Rafi</Name> <LastName>rafifa</LastName> -<Courses> -<Course Id="02"> <Name>Java</Name> </Course> -<Course Id="03"> <Name>Oracle</Name> </Course> </Courses> </Student> -<Student Id="004"> <Name>Yosi</Name> <LastName>Koen</LastName> -<Courses> -<Course Id="04"> <Name>SQL</Name> </Course> -<Course Id="03"> <Name>Oracle</Name> </Course> </Courses> </Student> </Students>
我需要知道两件事:
>所有课程
>每个课程中有多少学生在学习.
不同的课程:
//Course[not(preceding::Course/@Id = @Id)]