Determine (in XSLT) which nodes are in XML

wxdqz

New Member
I have 2 XML documents with similar structure. The only difference is that one has a Score node within a Student node and the other has a Completed node withing the Student node.

I would like to use a single XSL file to translate both of these documents. The question I have is: what do I use in the xsl:if node's test attribute to determine if the node is Score or Completed?

Here's a sample of each document:


<Report>
<Module Name="Module'sName">
<Student>
<Name>Cote, Chris</Name>
<Score>92</Score>
</Student>
<Student>
<Name>Doe, John</Name>
<Score>86</Score>
</Student>
</Module>
</Report>

And here's the 2nd document:

<Report>
<Module Name="ModulesName">
<Student>
<Name>Cote, Chris</Name>
<Complete>True</Complete>
</Student>
<Student>
<Name>Doe, Jane</Name>
<Complete>False</Complete>
</Student>
</Module>


I have a <xsl:for-each> node in the XSL document to loop through the Student tags, I just need to figure out whether that tag contains a Complete or a Score tag.

Chris
 
Back
Top