Subject: RE: [xsl] Problem with test condition in xsl:when From: "B. Tommie Usdin" <btusdin@xxxxxxxxxxxxxxxx> Date: Thu, 30 Aug 2001 12:20:16 -0400 |
>From: "Rene de Vries" <RdVries@xxxxxxxxxxx> >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> >Cc: <teclioness@xxxxxxxxxxx>, > "Tommie @ mulberrytech \(E-mail\)" <btusdin@xxxxxxxxxxxxxxxx> >Subject: RE: [xsl] Problem with test condition in xsl:when >Date: Thu, 30 Aug 2001 14:31:20 +0200 > >Hi Gurnandan, > >What is your problem? Your XML & XSL work fine with me (except for the >otherwise with the <xsl:for-each select="">) >Furtermore you should use an XSL the way it was intended: replace all your ><xsl:for-each select="abc">...</xsl:for-each> with one line: ><xsl:apply-template select="abc"/> and move the source of the for-each to a >seperate template <xsl:template match="abc"> > >Greetings René > {@ @} > ^ > \_/ > >"You don't need eyes to see, you need vision!" >-----Oorspronkelijk bericht----- >Van: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]Namens Gurnandan Kaur >Verzonden: donderdag 30 augustus 2001 10:55 >Aan: XSL-List@xxxxxxxxxxxxxxxxxxxxxx >Onderwerp: [xsl] Problem with test condition in xsl:when > > >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}</TimesheetStatusU >ID> > <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}</AttendanceCat >egoryUID> > <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}</StandardCredi >tTypeUID> > </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}</AttendanceCat >egoryUID> > <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}</StandardCredi >tTypeUID> > </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 -- ====================================================================== B. Tommie Usdin mailto:btusdin@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Phone: 301/315-9631 Suite 207 Direct Line: 301/315-9634 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Problem with test conditi, Joerg Pietschmann | Thread | [xsl] Is this possible in XSLT, Nicholas Waltham |
RE: [xsl] http request - unexpected, Mulberry Technologie | Date | RE: [xsl] Very Simple Mathematical , Chris Bayes |
Month |