Subject: [xsl] Paging help please. From: Tham Tinh <khautinh@xxxxxxxxx> Date: Mon, 24 Jan 2005 13:06:17 -0800 (PST) |
I have done this far but I could not get any further please help. The following is my output, XSLT and XML files. I would like to do paging after Total Position Count line that I can click next or back for other Admin or division. Finacial Sail WMS Working Title Position Number Person Name Annual Salary Job Cls Band JVA Code Salary Standard Peer Group Employee Status Occ CD Sale Rep. JP17 Green, Cloud $72,600.00 SR 1 000 $74,760.00 Q 0 Temporary 183 Sale Rep. SDSS Shine, Sun $72,600.00 SR 1 000 $74,760.00 Q 0 Temporary 183 Employee Count: 2 Vacant Position Count: 0 Total Position Count: 2 Personnel Training WMS Working Title Position Number Person Name Annual Salary Job Cls Band JVA Code Salary Standard Peer Group Employee Status Occ CD Training Specialist DREW White, Golden $60,516.00 WMS 2 456 $60,516.00 C1 3 TRIAL SERVICE 600 Training Specialist EWQS Gate, Golden $60,516.00 WMS 2 456 $60,516.00 C1 3 TRIAL SERVICE 600 Employee Count: 2 Vacant Position Count: 0 Total Position Count: 2 Personnel Personnel WMS Working Title Position Number Person Name Annual Salary Job Cls Band JVA Code Salary Standard Peer Group Employee Status Occ CD IT SDFG Red, Brow $35,808.00 WMS 1 456 $53,112.00 B K Manager-ACTING 180 Employee Count: 1 Vacant Position Count: 0 Total Position Count: 1 --------------------------------------------------- XSLT file <?xml version='1.0' encoding='utf-8' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <!-- Step 1: Define the primary key to be used in the Muenchian grouping. The beautiful thing about the xsl:key element in our example is that once we know the "Administration", we can easily find all of the WMSReport that match that Administration. The xsl:key element (different from the key() function) is defined as follows:--> <xsl:key name="dsWMSRpt" match="WMSReport" use="ReportUnitTitle"/> <!--Set the paging characteristics - number of records per page, page number and the record count--> <!-- Set the number of records per page--> <xsl:param name="recordsPerPage" select="10" /> <!-- Page Number field --> <xsl:param name="pageNumber" select="0" /> <!--Record Count Field--> <xsl:param name="recordCount" select="25" /> <!-- Template for our root rule --> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <!-- Template for our "dsWMSRpt" rule --> <xsl:template match="dsWMSRpt"> <!--Step 2: Loop through the unique regions (the primary key) in our document. --> <xsl:for-each select="//WMSReport[generate-id(.)=generate-id(key('dsWMSRpt',ReportUnitTitle))]"> <!-- Sort Primary key by ApptStatusCode in ascending order --> <xsl:sort select="ApptStatusCode" order="ascending"/> <!-- Display the region as our table header --> <h2 align="Center"><xsl:value-of select="Administration"/></h2> <h3 align="Center"><xsl:value-of select="ReportUnitTitle"/></h3> <!--Display all nodes for a given Administration in a table--> <table border="0"> <tr> <th>WMS Working Title</th> <th>Position Number</th> <th>Person Name</th> <th>Annual Salary</th> <th>Job Cls</th> <th>Band</th> <th>JVA Code</th> <th>Salary Standard</th> <th>Peer Group</th> <th>Employee Status</th> <th>Occ CD</th> </tr> <!-- For each value in our key collection for the given Administration display values --> <xsl:for-each select="key('dsWMSRpt',ReportUnitTitle)"> <!--this shows the output in table format - and shows only that many records passed in the recordcount parameter --> <xsl:if test="position() > $recordsPerPage * number($pageNumber) and position() <= number($recordsPerPage * number($pageNumber) + $recordsPerPage)"> <!-- Each record on a seperate row --> <!-- The expression "key('dsWMSRpt',Administration)" will return all of the "WMSReport" elements from the key table whose "use=" expression defined in xsl:key (see xsl:key at top) evaluated to the same value as the "Administration" child of the current element. In the the example, we specified use="Admnistration". If Administration has a value of ".EXEC", then all of the WMSReport elements from the key table that contain a child element with a value of ".EXEC" will be returned. --> <!--Sort our secondary key, product nodes, by ApptStatusCode--> <!--xsl:sort select="ApptStatusCode"/--> <tr> <xsl:if test="(position() mod 2 = 1)"> <xsl:attribute name="bgcolor">#ccffff</xsl:attribute> </xsl:if> <td><xsl:value-of select="WMS_x0020_Working_x0020_Title"/></td> <td><xsl:value-of select="PositionNumber"/></td> <td><xsl:value-of select="Person_x0020_Name"/></td> <td> <xsl:choose> <xsl:when test="AnnualSalary>0"> <!--format number function has been used in the next line--> <xsl:value-of select='format-number(AnnualSalary, "$###,###.00")' /> </xsl:when> <xsl:otherwise> 0 </xsl:otherwise> </xsl:choose> </td> <td><xsl:value-of select="JobClassCode"/></td> <td><xsl:value-of select="Band"/></td> <td><xsl:value-of select="JVACode"/></td> <td> <xsl:choose> <xsl:when test="Salary_x0020_Standard>0"> <!--format number function has been used in the next line--> <xsl:value-of select='format-number(Salary_x0020_Standard, "$###,###.00")' /> </xsl:when> <xsl:otherwise> 0 </xsl:otherwise> </xsl:choose> </td> <td><xsl:value-of select="Peer_x0020_Group"/></td> <!--concat function has been used in the next line--> <td><xsl:value-of select='concat(ApptStatusCode, " ", AppointmentStatusTitle)' /></td> <td><xsl:value-of select="OccupationCode"/></td> </tr> </xsl:if> </xsl:for-each> </table> <br> Employee Count: <xsl:value-of select="count(key('dsWMSRpt',ReportUnitTitle)[Person_x0020_Name!='Vacancy' and Person_x0020_Name!=''])"/> </br> <br> Vacant Position Count: <xsl:value-of select="count(key('dsWMSRpt',ReportUnitTitle)[Person_x0020_Name='Vacancy'])"/> </br> <br> Total Position Count: <xsl:value-of select="count(key('dsWMSRpt',ReportUnitTitle))"/> </br> </xsl:for-each> <br> <!-- Start Of Show previous/next page links--> <!-- Show the previous page, only if pageNumber>0 --> <p align="Center"> <span> <xsl:if test="$pageNumber > 0"> <xsl:element name="a"> <xsl:attribute name="href">?pageNumber= <xsl:value-of select="number($pageNumber)-1" /> </xsl:attribute> << Previous Page </xsl:element> </xsl:if> <!-- Next page, do not show when at end() of listing --> <xsl:if test="($recordCount - ((1+number($pageNumber)) * $recordsPerPage)) < 1"> <xsl:element name="a"> <xsl:attribute name="href">?pageNumber= <xsl:value-of select="number($pageNumber)+1" /> </xsl:attribute> Next page >> </xsl:element> </xsl:if> <!-- End Of Show previous/next page links--> </span> </p> </br> </xsl:template> </xsl:stylesheet> ---------------------------------------------------- XML file <?xml version="1.0" standalone="yes"?> <dsWMSRpt> <WMSReport> <AdministrationCode>HRS</AdministrationCode> <DivisionSort>HRS/Finacial</DivisionSort> <Status_x0020_Order>1</Status_x0020_Order> <Administration>Finacial</Administration> <DivisionTitle>Sale</DivisionTitle> <ReportUnitTitle>Sail</ReportUnitTitle> <WMS_x0020_Working_x0020_Title>Sale Rep.</WMS_x0020_Working_x0020_Title> <PositionNumber> JP17</PositionNumber> <Person_x0020_Name>Green, Cloud </Person_x0020_Name> <ApptSalaryUnitCode>M</ApptSalaryUnitCode> <SalaryUnitAmount>6050.0000</SalaryUnitAmount> <AnnualSalary>72600</AnnualSalary> <Band>1</Band> <JVACode>000</JVACode> <Salary_x0020_Standard>74760.0000</Salary_x0020_Standard> <Peer_x0020_Group>Q</Peer_x0020_Group> <ApptStatusCode>0</ApptStatusCode> <AppointmentStatusTitle>Temporary</AppointmentStatusTitle> <ApptJobClassCode>SR</ApptJobClassCode> <JobClassCode>SR</JobClassCode> <ApptPartTimePct>100</ApptPartTimePct> <PositionCountyCode>27</PositionCountyCode> <PersonID>111111111</PersonID> <PositionOrgCode>000</PositionOrgCode> <SeniorityDate>2003-11-20T00:00:00.0000000-08:00</SeniorityDate> <OccupationCode>183</OccupationCode> <SnapshotDate>2004-08-08T00:00:00.0000000-07:00</SnapshotDate> <ReportingUnitID>38</ReportingUnitID> <SupervisorInd>Y</SupervisorInd> </WMSReport> <WMSReport> <AdministrationCode>HRS</AdministrationCode> <DivisionSort>HRS/Finacial</DivisionSort> <Status_x0020_Order>1</Status_x0020_Order> <Administration>Finacial</Administration> <DivisionTitle>Sale</DivisionTitle> <ReportUnitTitle>Sail</ReportUnitTitle> <WMS_x0020_Working_x0020_Title>Sale Rep.</WMS_x0020_Working_x0020_Title> <PositionNumber> SDSS</PositionNumber> <Person_x0020_Name>Shine, Sun </Person_x0020_Name> <ApptSalaryUnitCode>M</ApptSalaryUnitCode> <SalaryUnitAmount>6050.0000</SalaryUnitAmount> <AnnualSalary>72600</AnnualSalary> <Band>1</Band> <JVACode>000</JVACode> <Salary_x0020_Standard>74760.0000</Salary_x0020_Standard> <Peer_x0020_Group>Q</Peer_x0020_Group> <ApptStatusCode>0</ApptStatusCode> <AppointmentStatusTitle>Temporary</AppointmentStatusTitle> <ApptJobClassCode>SR</ApptJobClassCode> <JobClassCode>SR</JobClassCode> <ApptPartTimePct>100</ApptPartTimePct> <PositionCountyCode>27</PositionCountyCode> <PersonID>44444444444</PersonID> <PositionOrgCode>000</PositionOrgCode> <SeniorityDate>2003-11-20T00:00:00.0000000-08:00</SeniorityDate> <OccupationCode>183</OccupationCode> <SnapshotDate>2004-08-08T00:00:00.0000000-07:00</SnapshotDate> <ReportingUnitID>38</ReportingUnitID> <SupervisorInd>Y</SupervisorInd> </WMSReport> <WMSReport> <AdministrationCode>HRS</AdministrationCode> <DivisionSort>HRS/Personnel</DivisionSort> <Status_x0020_Order>Z</Status_x0020_Order> <Administration>Personnel</Administration> <DivisionTitle>Some Thing</DivisionTitle> <ReportUnitTitle>Personnel</ReportUnitTitle> <WMS_x0020_Working_x0020_Title>IT</WMS_x0020_Working_x0020_Title> <PositionNumber>SDFG</PositionNumber> <Person_x0020_Name>Red, Brow</Person_x0020_Name> <ApptSalaryUnitCode>M</ApptSalaryUnitCode> <SalaryUnitAmount>2984.0000</SalaryUnitAmount> <AnnualSalary>35808</AnnualSalary> <Band>1</Band> <JVACode>456</JVACode> <Salary_x0020_Standard>53112.0000</Salary_x0020_Standard> <Peer_x0020_Group>B</Peer_x0020_Group> <ApptStatusCode>K</ApptStatusCode> <AppointmentStatusTitle>Manager-ACTING</AppointmentStatusTitle> <ApptJobClassCode>WMS</ApptJobClassCode> <JobClassCode>WMS</JobClassCode> <ApptPartTimePct>100</ApptPartTimePct> <PositionCountyCode>34</PositionCountyCode> <PersonID>222222222</PersonID> <PositionOrgCode>G70 </PositionOrgCode> <SeniorityDate>2003-10-01T00:00:00.0000000-07:00</SeniorityDate> <OccupationCode>180</OccupationCode> <SnapshotDate>2004-08-08T00:00:00.0000000-07:00</SnapshotDate> <ReportingUnitID>34</ReportingUnitID> <SupervisorInd>Y</SupervisorInd> </WMSReport> <WMSReport> <AdministrationCode>HRS</AdministrationCode> <DivisionSort>HRS/Traninig</DivisionSort> <Status_x0020_Order>1</Status_x0020_Order> <Administration>Personnel</Administration> <DivisionTitle>Training</DivisionTitle> <ReportUnitTitle>Training</ReportUnitTitle> <WMS_x0020_Working_x0020_Title>Training Specialist</WMS_x0020_Working_x0020_Title> <PositionNumber>DREW</PositionNumber> <Person_x0020_Name>White, Golden </Person_x0020_Name> <ApptSalaryUnitCode>M</ApptSalaryUnitCode> <SalaryUnitAmount>5043.0000</SalaryUnitAmount> <AnnualSalary>60516</AnnualSalary> <Band>2</Band> <JVACode>456</JVACode> <Salary_x0020_Standard>60516.0000</Salary_x0020_Standard> <Peer_x0020_Group>C1</Peer_x0020_Group> <ApptStatusCode>3</ApptStatusCode> <AppointmentStatusTitle>TRIAL SERVICE</AppointmentStatusTitle> <ApptJobClassCode>WMS</ApptJobClassCode> <JobClassCode>WMS</JobClassCode> <ApptPartTimePct>100</ApptPartTimePct> <PositionCountyCode>34</PositionCountyCode> <PersonID>333333333</PersonID> <PositionOrgCode>DSF</PositionOrgCode> <SeniorityDate>2004-01-02T00:00:00.0000000-08:00</SeniorityDate> <OccupationCode>600</OccupationCode> <SnapshotDate>2004-08-08T00:00:00.0000000-07:00</SnapshotDate> <ReportingUnitID>19</ReportingUnitID> <SupervisorInd>N</SupervisorInd> </WMSReport> <WMSReport> <AdministrationCode>HRS</AdministrationCode> <DivisionSort>HRS/Traninig</DivisionSort> <Status_x0020_Order>1</Status_x0020_Order> <Administration>Personnel</Administration> <DivisionTitle>Training</DivisionTitle> <ReportUnitTitle>Training</ReportUnitTitle> <WMS_x0020_Working_x0020_Title>Training Specialist</WMS_x0020_Working_x0020_Title> <PositionNumber>EWQS</PositionNumber> <Person_x0020_Name>Gate, Golden </Person_x0020_Name> <ApptSalaryUnitCode>M</ApptSalaryUnitCode> <SalaryUnitAmount>5043.0000</SalaryUnitAmount> <AnnualSalary>60516</AnnualSalary> <Band>2</Band> <JVACode>456</JVACode> <Salary_x0020_Standard>60516.0000</Salary_x0020_Standard> <Peer_x0020_Group>C1</Peer_x0020_Group> <ApptStatusCode>3</ApptStatusCode> <AppointmentStatusTitle>TRIAL SERVICE</AppointmentStatusTitle> <ApptJobClassCode>WMS</ApptJobClassCode> <JobClassCode>WMS</JobClassCode> <ApptPartTimePct>100</ApptPartTimePct> <PositionCountyCode>34</PositionCountyCode> <PersonID>333333333</PersonID> <PositionOrgCode>FET</PositionOrgCode> <SeniorityDate>2004-01-02T00:00:00.0000000-08:00</SeniorityDate> <OccupationCode>600</OccupationCode> <SnapshotDate>2004-08-08T00:00:00.0000000-07:00</SnapshotDate> <ReportingUnitID>19</ReportingUnitID> <SupervisorInd>N</SupervisorInd> </WMSReport> </dsWMSRpt> ===== "It is essential to know that to be a happy person, a happy family, a happy society, it is very crucial to have a good heart, that is very crucial," Dalai Lama __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] thanks, juan valentín-pastra | Thread | [xsl] Data types and xsl:sequence, Jim Neff |
Re: [xsl] XSL for 2 columns- Format, samir sawant | Date | [xsl] Data types and xsl:sequence, Jim Neff |
Month |