This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Problem with test condition in xsl:when
- To: XSL-List at lists dot mulberrytech dot com
- Subject: [xsl] Problem with test condition in xsl:when
- From: Gurnandan Kaur <teclioness at yahoo dot co dot uk>
- Date: Thu, 30 Aug 2001 09:50:34 +0100 (BST)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi
The following is the XML file I am trying to
transform.
<?xml version="1.0" encoding="ISO-8859-1"?>
<Timesheet>
<StaffID>30061</StaffID>
<WeekStartDate>08 Jan 2001</WeekStartDate>
<TimesheetStatusUID>{8A690915-17AC-11D5-A152-000347240DC9}</TimesheetStatusUID>
<NumberOfCases>0</NumberOfCases>
<Status>Submitted</Status>
<Fullname/>
<Day>
<StaffID>30061</StaffID>
<AttDate>08 Jan 2001</AttDate>
<OnCall>N</OnCall>
<OnCallTypeUID>{00000000-0000-0000-0000-000000000000}</OnCallTypeUID>
<Shift>
<ShiftUID>{5D0EAB70-881D-11D5-A19F-000347240DC9}</ShiftUID>
<Date>08 Jan 2001</Date>
<ShiftIndex>2</ShiftIndex>
<TimeStart>01:00</TimeStart>
<TimeEnd>05:00</TimeEnd>
<AttendanceCategoryUID>{D13A0662-0EFF-11D5-A150-000347240DC9}</AttendanceCategoryUID>
<ShiftChange>N</ShiftChange>
<ShiftChangeUID>{00000000-0000-0000-0000-000000000000}</ShiftChangeUID>
<Comments>this is the first shift</Comments>
<FlexibleChange>N</FlexibleChange>
<FlexibleContactability>N</FlexibleContactability>
<TotalMinutes>240</TotalMinutes>
<StandardCreditTypeUID>{B8505354-494D-11D5-A173-000347240DC9}</StandardCreditTypeUID>
</Shift>
</Day>
<Day>
<StaffID>30061</StaffID>
<AttDate>09 Jan 2001</AttDate>
<OnCall>Y</OnCall>
<OnCallTypeUID>{131DC162-16C9-11D5-A151-000347240DC9}</OnCallTypeUID>
<Shift>
<ShiftUID>{5D0EAB71-881D-11D5-A19F-000347240DC9}</ShiftUID>
<Date>09 Jan 2001</Date>
<ShiftIndex>2</ShiftIndex>
<TimeStart>02:00</TimeStart>
<TimeEnd>07:00</TimeEnd>
<AttendanceCategoryUID>{D13A0662-0EFF-11D5-A150-000347240DC9}</AttendanceCategoryUID>
<ShiftChange>N</ShiftChange>
<ShiftChangeUID>{00000000-0000-0000-0000-000000000000}</ShiftChangeUID>
<Comments>this is the sec shift</Comments>
<FlexibleChange>N</FlexibleChange>
<FlexibleContactability>N</FlexibleContactability>
<TotalMinutes>300</TotalMinutes>
<StandardCreditTypeUID>{B8505354-494D-11D5-A173-000347240DC9}</StandardCreditTypeUID>
</Shift>
</Day>
</Timesheet>
Following is the XSL I am using to tranform
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<table border="1" cellspacing="0"
class="TableFullWidth" width="100%">
<tr bgcolor="silver" class="HeadRow">
<td width="14%"> </td>
<td width="15%" colspan="2">Att. Time</td>
<td width="32%">Attendance Category</td>
<td width="23%">Attendance Change</td>
<td width="16%">Contacted</td>
</tr>
<tr bgcolor="silver" class="HeadRow">
<td> </td>
<td>Start</td>
<td>End</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<xsl:for-each select="/Timesheet/Day">
<xsl:variable name="OnCall" select="./OnCall"/>
<xsl:for-each select="./Shift">
<tr bgcolor="silver" class="HeadRow">
<!--
If intDay = 1 Then
-->
<td ><xsl:value-of select="./Date"/> -
<xsl:value-of select="./AttDate"/></td>
<!--
Else
<td valign="middle"
align="right"><b>=intDay.</b></td>-->
<!--
End If
-->
<td valign="middle" align="center"><xsl:value-of
select="./TimeStart"/></td>
<td valign="middle" align="center"><xsl:value-of
select="./TimeEnd"/></td>
<td valign="middle" align="center">
<xsl:value-of select="./AttendanceCategoryUID"/>
<!--
If trim(strAttCatID)<>
"{00000000-0000-0000-0000-000000000000}" Then
Dim sAttXML
sAttXML = oPickLists.AttendanceCategories
oDoc.loadXML(sAttXML)
Set oLists =
oDoc.getElementsByTagName("ListEntry")
For Each oOption In oLists
If trim(strAttCatID) = trim(GetNodeValue(oOption,
"Key")) Then
-->
<!--=trim(GetNodeValue(oOption,"Item"))--> -
<!--
Exit For
End If
Next
Else
Response.Write "  - "
End If
-->
<xsl:choose>
<xsl:when
test="./Timesheet/Day/Shift/AttendanceCategoryUID
='{00000000-0000-0000-0000-000000000000}'">
  -
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="">
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<!--
If trim(strStdCredit) <>
"{00000000-0000-0000-0000-000000000000}" Then
Dim sStdCredit
sStdCredit = oPickLists.StandardCreditTypes
oDoc.loadXml(sStdCredit)
Set oLists =
oDoc.getElementsByTagName("ListEntry")
For Each oOption In oLists
If trim(strStdCredit) =
trim(GetNodeValue(oOption, "Key")) Then
-->
<!--=trim(GetNodeValue(oOption,"Item"))-->
<!--
Exit For
End If
Next
Else
Response.Write " "
End If
-->
</td>
<td valign="middle">
<!--
If trim(strShiftChangeID)<>
"{00000000-0000-0000-0000-000000000000}" Then
sShiftXML = oPickLists.ShiftChanges
oDoc.loadXML(sShiftXML)
Set oLists =
oDoc.getElementsByTagName("ListEntry")
For Each oOption In oLists
If trim(strShiftChangeID) =
trim(GetNodeValue(oOption, "Key")) Then
-->
<!--=trim(GetNodeValue(oOption,"Item"))-->
<!--
Exit For
End If
Next
Else
Response.Write " "
End If
-->
</td>
<td valign="center" align="center"><xsl:value-of
select="./FlexibleContactability"/><!--If
strContact="Y" Then Response.write "Yes" Else
Response.Write "No" End If-->
</td>
</tr>
<tr>
<!--
If intDay = 1 Then
-->
<td>
on Call - <xsl:value-of select="$OnCall"/><!--If
strOnCall="Y" Then Response.Write "Yes" Else If
strOnCall="N" Then Response.Write "No" End
If-->
<br/>
<!--
If trim(strOnCallType)<>
"{00000000-0000-0000-0000-000000000000}" Then
sShiftXML = oPickLists.CalloutReasons
oDoc.loadXML(sShiftXML)
Set oLists =
oDoc.getElementsByTagName("ListEntry")
For Each oOption In oLists
If trim(strOnCallType) =
trim(GetNodeValue(oOption, "Key")) Then
-->
<!--=trim(GetNodeValue(oOption,"Item"))-->
<!--
Exit For
End If
Next
Else
-->
 
<!--
End If
-->
</td>
<!--
Else
-->
<td> </td>
<!--End If-->
<td valign="top" align="left"
colspan="7"><xsl:value-of select="/Comments"/></td>
</tr>
<!--
intDay = intDay +1
Next
Next
-->
</xsl:for-each>
</xsl:for-each>
</table>
<br/>
<table border="1" cellspacing="0"
class="TableFullWidth" width="100%">
<tr bgcolor="silver" class="HeadRow">
<td><b>Summary</b></td>
</tr>
<tr>
<td>If you were on a PCEA call during this week,
please enter the number of cases dealt by
you <b><xsl:value-of
select="/Timesheet/NumberOfCases"/></b></td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
The problem comes when I try to test the value of node
"AttendanceCategoryUID", but whatever I am using
doesnt seem to resolve the problem. Please suggest
what is wrong?? In xsl I use to say <xsl:when
test=".[/AttendanceCategoryUID='value']> and it would
work fine. This time it isnt. Is the way to access the
node any different in XSLT now?
Thanks for help.
____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list