Need some help: I want to only pull back the results for a specific ItemId, so if i wanted the only data for ItemId how could I adapt the template below?
I've tried for about 2 hours without any luck...
Here is a sample of my XML:
Need some help: I want to only pull back the results for a specific ItemId, so if i wanted the only data for ItemId how could I adapt the template below?
I've tried for about 2 hours without any luck...
Here is a sample of my XML:
This Xslt only brings the item with ItemId value equal to 2075.
Notice I added [ItemInfo/PeriodAttendanceInfo/ItemId=2075]
.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="dvt_2"/>
</xsl:template>
<xsl:template name="dvt_2">
<xsl:variable name="Rows" select="/ArrayOfPeriodAttendanceGroup/PeriodAttendanceGroup[ItemInfo/PeriodAttendanceInfo/ItemId=2075]"/>
<xsl:variable name="dvt_RowCount" select="count($Rows)"/>
<xsl:call-template name="dvt_2.rowContents">
<xsl:with-param name="Rows" select="$Rows"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="dvt_2.rowContents">
<xsl:param name="Rows"/>
<xsl:for-each select="$Rows">
<xsl:sort select="ItemInfo/PeriodAttendanceInfo" order="ascending"/>
<xsl:call-template name="dvt_2.rowContentsView"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_2.rowContentsView">
<xsl:variable name="subjectName" select="ItemInfo/PeriodAttendanceInfo/ItemText"/>
<tr class="{$subjectName}">
<xsl:element name="td">
<xsl:attribute name="class">
<xsl:value-of select="ItemInfo/PeriodAttendanceInfo/ItemText"/>
</xsl:attribute>
<xsl:variable name="subjectID" select="ItemInfo/PeriodAttendanceInfo/ItemId"/>
<a class="leftAlign" href="../Departments/{$subjectID}">
<xsl:value-of select="ItemInfo/PeriodAttendanceInfo/ItemText"/>
</a>
</xsl:element>
<td>
<p class="name">
<xsl:value-of select="Total"/>
</p>
</td>
<td>
<p class="name">
<xsl:value-of select="Present"/>
</p>
</td>
<td>
<p class="name">
<xsl:value-of select="Late"/>
</p>
</td>
<td>
<p class="name">
<xsl:value-of select="UnauthorisedAbsence"/>
</p>
</td>
</tr>
</xsl:template>
<xsl:template name="dvt_1.empty">
<xsl:variable name="dvt_ViewEmptyText">There is no timetable view for today</xsl:variable>
<table border="0" width="100%">
<tr>
<td class="ms-vb">
<xsl:value-of select="$dvt_ViewEmptyText"/>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>