XML and XSL connection
- by Irgat
I have a problem between XML and XSL files. In XML file, there are some elements such as *<school><student studentID="12345"><nameStud I</name<takesCMPE471</takes<takesCMPE412</takes<takesCMPE100</takes</student<student studentID="67890"><nameStud II</name<takesCMPE471</takes<takesCMPE412</takes</student<course courseCode="CMPE471"<courseName>NAME I </courseName>
<description>DESC I </description>
</course><course courseCode="CMPE412"<courseName>NAME II </courseName>
<description>DESC II </description>
</course><course courseCode="CMPE100"<courseName>NAME III </courseName>
<description>DESC III </description>
</course>In XSL file,I want to reach "description" element which I specified "courseCode".Output should be like this, 1. Stud I a. CMPE471 Desc I b. CMPE412 Desc II c. CMPE100 Desc III2. Stud II a. CMPE471 Desc I b. CMPE412 Desc II
In XSL file, I tried to write something :
<ol
<xsl:for-each select="/school/student"
<xsl:sort data-type="text" order="ascending" select="name"/
<li<xsl:value-of select="name"/
<ol type="a"
<xsl:for-each select="takes"
<xsl:sort data-type="text" select="text()" order="ascending"/
<li
<xsl:for-each select="/school/course"//PROBLEM
<xsl:value-of select="description [@courseCode = text()]"///PROBLEM
</xsl:for-each//PROBLEM
</li
</xsl:for-each
</ol
</xsl:for-each
</ol
Thanks.