Once again I'm trying to get to grips with the potential of XSLT. I've come across a situation where <xsl:copy-of select=""/> will suffice. As seen below:



<xsl:copy-of select="Instructors"/>


However, the XML is as follows:



<Instructors>
<Lecturer>
<First_Name>Jerry</First_Name>
<Middle_Initial>R.</Middle_Initial>
<Last_Name>Cain</Last_Name>
</Lecturer>
<Professor>
<First_Name>Eric</First_Name>
<Last_Name>Roberts</Last_Name>
</Professor>
<Professor>
<First_Name>Mehran</First_Name>
<Last_Name>Sahami</Last_Name>
</Professor>
</Instructors>


The output is as follows:



Jerry R. Cain Eric Roberts Mehran Sahami


The output I would desire (and could accomplish with a template) would be:



Lecturer: Jerry R. Cain
Professor: Eric Roberts
Professor: Mehran Sahami


As you can see, there is actually more detailed information inside the "Instructors" node, yet when I use <xsl:copy-of select="Instructors"/> it outputs just the values of child nodes. I know this is the expected output but I was wondering if I can avoid making another template by manipulating <xsl:copy-of select="Instructors"/> to show some of the node names.


Thanks in advance and sorry for the fairly vague question.


No comments:

Post a Comment