473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Sorting Help

1
I need help sorting XML file. Below is the XSLT, I am using. I am trying to sort the PIPTransaction based on Usage tag, UsagePurpose. If UsagePurpose="Cancel" transaction should be at the starting of the file and than rest of the transaction after UsagePurpose="Cancel" . Thanks In advance.

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:pd="http://www.oeb.gov.on.ca" exclude-result-prefixes="pd">
  3. <xsl:template name="Usage">
  4.             <xsl:apply-templates mode="copynode"/>
  5. </xsl:template>
  6. <xsl:template match="@*" mode="copynode">
  7.             <xsl:copy>
  8.                         <xsl:apply-templates select="@*" mode="copynode"/>
  9.                         <xsl:apply-templates mode="copynode"/>  
  10.             <xsl:for-each select="pd:Usage">
  11.             <xsl:sort select="@UsagePurpose" order="descending" data-type="text"/>
  12.                         </xsl:for-each>
  13.             </xsl:copy>
  14. </xsl:template>
  15. <xsl:template match="*" mode="copynode">
  16.             <!--xsl:element name="{local-name()}" namespace=""-->
  17.             <xsl:element name="{local-name()}">
  18.                         <xsl:apply-templates select="@*" mode="copynode"/>
  19.                         <xsl:apply-templates mode="copynode"/>  
  20.             </xsl:element>
  21. </xsl:template>
  22. </xsl:stylesheet>
XML file

<?xml version="1.0" encoding="UTF-8"?>
<PIPEDocument CreationDate="20070125070128125ES" DocumentReferenceNumber="doc000006759814" Version="3.1" xsi:schemaLocation="http://www.oeb.gov.on.ca PIPEDocument.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.oeb.gov.on.ca">
<PIPTransaction TransactionReferenceNumber="000006759814">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759750">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>997095</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759835">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759845">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759857">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>997095</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759999">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006760024">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006760061">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006760064">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006760166">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006760186">
<Usage BillRequired="Yes" UsagePurpose="Original">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006760869">
<InvoiceSettlementTotal BillPurpose="Original">
<MarketParticipantInformation>
<CompanyName>ties Ltd</CompanyName>
<GSTRegistrationNumber>820586</GSTRegistrationNumber>
<MarketParticipantAccountNumber ParticipantType="Distributor">02293594</MarketParticipantAccountNumber>
</MarketParticipantInformation>
</InvoiceSettlementTotal>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006760673">
<InvoiceSettlementDetail BillPurpose="Original" TransactionCrossReferenceNumber="000006760869">
<MarketParticipantInformation>
<CompanyName>ties Ltd</CompanyName>
<GSTRegistrationNumber>867120586</GSTRegistrationNumber>
<MarketParticipantAccountNumber ParticipantType="Distributor">0293594</MarketParticipantAccountNumber>
</MarketParticipantInformation>
</InvoiceSettlementDetail>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006756662">
<NSLSDaily UnitOfMeasure="kWh" Date="20070109">
<Zone>
<NSLSEntry>
<Consumption>149444</Consumption>
<Price>3.06</Price>
</NSLSEntry>
</Zone>
</NSLSDaily>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759538">
<ApplicationAdviceAccept OriginalTransactionReferenceNumber="70230000700980 " PIPTransactionType="InvoiceBillReady">
<ConsumerInformation>
<FullName>Store 26805</FullName>
</ConsumerInformation>
<AccountInformation>
<ConsumerAccountNumber ParticipantType="Distributor">5717204267001720</ConsumerAccountNumber>
</AccountInformation>
</ApplicationAdviceAccept>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759632">
<DropRequest>
<DropInformation>
<Reason>Nonpayment By Customer</Reason>
</DropInformation>
</DropRequest>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759640">
<Usage OriginalTransactionReferenceNumber="000006121188" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="00000659646">
<Usage OriginalTransactionReferenceNumber="00000698902" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759642">
<Usage OriginalTransactionReferenceNumber="000006238274" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759643">
<Usage OriginalTransactionReferenceNumber="000006359096" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759651">
<Usage OriginalTransactionReferenceNumber="000006358797" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759660">
<Usage OriginalTransactionReferenceNumber="000006626224" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759653">
<Usage OriginalTransactionReferenceNumber="000006237816" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
<PIPTransaction TransactionReferenceNumber="000006759662">
<Usage OriginalTransactionReferenceNumber="000006121616" BillRequired="Yes" UsagePurpose="Cancel">
<ConsumerInformation>
<FullName>o Ltd. Partnership</FullName>
</ConsumerInformation>
</Usage>
</PIPTransaction>
</PIPEDocument>
May 23 '07 #1
1 1244
dorinbogdan
839 Expert 512MB
Hi,

Did you succeed to solve your problem?
If not, please let me know.
If yes, feel free to share it, to help other members with similar questions.

Thanks,
Dorin.
May 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: dont bother | last post by:
This is really driving me crazy. I have a dictionary feature_vectors{}. I try to sort its keys using #apply sorting on feature_vectors sorted_feature_vector=feature_vectors.keys()...
9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
4
by: Ambica Jain | last post by:
Hi, I want custom sorting on some of the columns in the datagrid. And i am able to do the same by overriding MouseDown event. However, i need to rebind my datatable to reflect the changes in...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
6
by: =?Utf-8?B?RGFu?= | last post by:
I am reposting a question from about 3 weeks ago ("sorting capability"). I have an aspx page in which I get the data from a database dynamically, through C# code, by creating a dynamic table...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.