> I am wishing to apply a template to the following XML. There are
multiple event nodes within the register root node. For each of the
event nodes there are a list of students taking the Event. I wish to
apply a template (and thus get the data) for the same student across
the events. I can apply the template to student 18 for event 1, how
do i then get the data for student 18 from event 2 and then for event
3 and so on?
Hi,
I think this might be a way to the solution of your problem.
<xsl:key name="students" match="student/code" use="."/>
<xsl:template match="/">
<xsl:apply-templates select="//student[generate-id(code) =
generate-id(key('students',code))]">
<xsl:sort select="name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="student">
student name: <xsl:value-of select="name"/>
<xsl:apply-templates select="//event[student/code=current()/code]"/>
</xsl:template>
<xsl:template match="event">
event: <xsl:value-of select="code"/>
</xsl:template>
this code produces:
student name: Janet Bloggs
event: 1
event: 2
student name: Joe Bloggs
event: 1
event: 2
Is this useful?
Joris Gillis
--
Ceterum censeo XML omnibus esse utendum