473,396 Members | 1,892 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,396 software developers and data experts.

Sorting issue

1
Hello all,

I am having problems sorting my xml on two fields. For each result I want to sort resultItem elements based on child elements typId and macroSequence.

so I want result element like
[HTML]<result>
<resultItem>
<typId>82</typId>
<macrosequence>1/<marcosequence>
</resultItem>
<resultItem>
<typId>82</typId>
<macrosequence>2/<marcosequence>
</resultItem>
<resultItem>
<typId>82</typId>
<macrosequence>3/<marcosequence>
</resultItem>
<resultItem>
<typId>83</typId>
<macrosequence>1/<marcosequence>
</resultItem>
<resultItem>
<typId>83</typId>
<macrosequence>2/<marcosequence>
</resultItem>
</result>[/HTML]
I tried all the solutions online none worked. I will be using this xsl within a BPEL process.

I am pasting xml and xsl I am using.

[HTML]<DIRequest xmlns="http://www.ameripath.com/pathway/request/di" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<DeliveryType>gg</DeliveryType>
<TrackingId>122056</TrackingId>
<Accession>
<accessionNumber>CT06-207119-CS</accessionNumber>
<accessionCreatedDate>2006-12-29</accessionCreatedDate>
<attnClientServices>false</attnClientServices>
<blockCount>0</blockCount>
<comment/>
<containerCount>0</containerCount>
<encounterNumber/>
<extraLabelCount>0</extraLabelCount>
<slideCount>0</slideCount>
<mrn/>
<priority>ROUTINE</priority>
<accessionStatus>Final</accessionStatus>
<specimenTypes>
<specimenType>
<testMargin>false</testMargin>
<testSelectBest>false</testSelectBest>
<specimenTypeName>Skin</specimenTypeName>
<testAll>false</testAll>
<receivedDateTime>2006-12-29</receivedDateTime>
<highRisk>false</highRisk>
<collectionDateTime>2006-12-28</collectionDateTime>
<clinicalInformations>
<clinicalInformation>
<type>1</type>
<description>A. DF
B. BCC</description>
</clinicalInformation>
</clinicalInformations>
<specimenParts>
<specimenPart>
<receivedDateTime>2006-12-29</receivedDateTime>
<collectionDateTime>2006-12-28</collectionDateTime>
<specimenPartName>Skin</specimenPartName>
<partId>A</partId>
<partDescription>RIGHT LEG</partDescription>
<blockCount>0</blockCount>
<containerCount>1</containerCount>
<extraLabelCount>0</extraLabelCount>
<slideCount>0</slideCount>
<grossingResultText>9X8X3 MM</grossingResultText>
<procedures>
<procedure>
<procedureName>ermPath</procedureName>
<procedureNumber>24</procedureNumber>
<procedureStatus>FINAL</procedureStatus>
<signedoutById>rcashman</signedoutById>
<signedoutByName>Robert Cashman</signedoutByName>
<signedoutByInitials>R.C.</signedoutByInitials>
<result>
<resultType>DERM</resultType>
<readingLocationId>20254</readingLocationId>
<readingLocationName>iagnostics</readingLocationName>
<readingLocationPrefix>CT</readingLocationPrefix>
<icdCodes>
<icdCode>
<shortDescription>BENIGN NEO SKIN LEG</shortDescription>
<longDescription>BENIGN NEOPLASM OF SKIN OF LOWER LIMB INCLUDING HIP</longDescription>
<identification>216.7</identification>
</icdCode>
</icdCodes>
<resultItems>
<resultItem>
<resultItemType>Derm - Microscopic Type</resultItemType>
<macroSequence>1</macroSequence><macroTxt>Beneath an acanthotic epidermis, there is a circumscribed unencapsulated area of collagen with an increase in fibroblasts with some histiocytes and trapped collagen bundles.</macroTxt>

<typId>83</typId>
</resultItem>
<resultItem>
<resultItemType>Derm - Diagnosis Type</resultItemType>

<macroSequence>1</macroSequence>
<macroTxt>
DERMATOFIBROMA
</macroTxt><typId>82</typId>
</resultItem>
</resultItems>
</result>
<signedoutDate>2007-01-03</signedoutDate>
<reportGeneratedDate>2007-01-03</reportGeneratedDate>
<processingInstructions>
<processingInstruction>
<processingInstructionName>Deeper x2</processingInstructionName>
<slides>
<slide>
<performById>aellis</performById>
<performingLocId>CT</performingLocId>
<performingLocName>Cstics</performingLocName>
<performingLocType>Parent</performingLocType>
</slide>
<slide>
<performById>aellis</performById>
<performingLocId>CT</performingLocId>
<performingLocName>Cgnostics</performingLocName>
<performingLocType>Parent</performingLocType>
</slide>
</slides>
</processingInstruction>
<processingInstruction>
<processingInstructionName>H&E</processingInstructionName>
<slides>
<slide>
<performById>aellis</performById>
<performingLocId>CT</performingLocId>
<performingLocName>nostics</performingLocName>
<performingLocType>Parent</performingLocType>
</slide>
</slides>
</processingInstruction>
</processingInstructions>
</procedure>
</procedures>
</specimenPart>
<specimenPart>
<receivedDateTime>2006-12-29</receivedDateTime>
<collectionDateTime>2006-12-28</collectionDateTime>
<specimenPartName>Skin</specimenPartName>
<partId>B</partId>
<partDescription>LEFT CHEEK</partDescription>
<blockCount>0</blockCount>
<containerCount>1</containerCount>
<extraLabelCount>0</extraLabelCount>
<slideCount>0</slideCount>
<grossingResultText>5X5X1 MM</grossingResultText>
<procedures>
<procedure>
<procedureName>rmPath</procedureName>
<procedureNumber>24</procedureNumber>
<procedureStatus>FINAL</procedureStatus>
<signedoutById>gt</signedoutById>
<signedoutByName>man</signedoutByName>
<signedoutByInitials>R.C.</signedoutByInitials>
<result>
<resultType>DERM</resultType>
<readingLocationId>20254</readingLocationId>
<readingLocationName>Diagnostics</readingLocationName>
<readingLocationPrefix>CT</readingLocationPrefix>
<icdCodes>
<icdCode>
<shortDescription>BENIGN NEO SKIN FACE OT</shortDescription>
<longDescription>BENIGN NEOPLASM OF SKIN OF OTHER AND UNSPECIFIED PARTS OF FACE</longDescription>
<identification>216.3</identification>
</icdCode>
</icdCodes>
<resultItems>
<resultItem>
<resultItemType>Derm - Diagnosis Type</resultItemType>

<macroSequence>3</macroSequence>
<macroTxt>NOTE: There is also an inflammatory cell infiltrate.</macroTxt><typId>82</typId>
</resultItem>
<resultItem>
<resultItemType>Derm - Microscopic Type</resultItemType>

<macroSequence>2</macroSequence>
<macroTxt>Beneath an irregular epidermis there are a number of sebaceous lobules with a sebaceous follicle and a few leukocytes in the dermis. The appearance is that of a benign sebaceous hyperplasia.</macroTxt><typId>83</typId>
</resultItem>
<resultItem>
<resultItemType>Derm - Diagnosis Type</resultItemType>

<macroSequence>6</macroSequence>
<macroTxt>B - Deeper sections reveal changes similar to those seen in the original ones.
RC/jp</macroTxt><typId>82</typId>
</resultItem>
<resultItem>
<resultItemType>Derm - Diagnosis Type</resultItemType>

<macroSequence>2</macroSequence>
<macroTxt>
SEBACEOUS HYPERPLASIA
</macroTxt><typId>82</typId>
</resultItem>
<resultItem>
<resultItemType>Derm - Diagnosis Type</resultItemType>

<macroSequence>4</macroSequence>
<macroTxt>Additional sections have been requested, and an addendum report will follow. </macroTxt><typId>83</typId>
</resultItem>
<resultItem>
<resultItemType>Derm - Diagnosis Type</resultItemType>

<macroSequence>5</macroSequence>
<macroTxt>ADDENDUM REPORT: JANUARY 3, 2007</macroTxt><typId>83</typId>
</resultItem>
</resultItems>
</result>
<signedoutDate>2007-01-03</signedoutDate>
<reportGeneratedDate>2007-01-03</reportGeneratedDate>
<processingInstructions>
<processingInstruction>
<processingInstructionName>H&E</processingInstructionName>
<slides>
<slide>
<performById>aellis</performById>
<performingLocId>CT</performingLocId>
<performingLocName>iagnostics</performingLocName>
<performingLocType>Parent</performingLocType>
</slide>
</slides>
</processingInstruction>
<processingInstruction>
<processingInstructionName>Deeper x2</processingInstructionName>
<slides>
<slide>
<performById>aellis</performById>
<performingLocId>CT</performingLocId>
<performingLocName>Ch Diagnostics</performingLocName>
<performingLocType>Parent</performingLocType>
</slide>
<slide>
<performById>aellis</performById>
<performingLocId>CT</performingLocId>
<performingLocName>C Diagnostics</performingLocName>
<performingLocType>Parent</performingLocType>
</slide>
</slides>
</processingInstruction>
</processingInstructions>
</procedure>
</procedures>
</specimenPart>
</specimenParts>
</specimenType>
</specimenTypes>
<patient>
<fullName>abc, ebf B</fullName>
<lastName>d</lastName>
<firstName>d</firstName>
<middleInitial>d</middleInitial>
<suffix/>
<prefix/>
<age>57</age>
<ageUnit>Y</ageUnit>
<dateofBirth>1900-11-19</dateofBirth>
<gender>M</gender>
<patientID>3434</patientID>
<ssn/>
<masterPatientIndexId>-3423</masterPatientIndexId>
</patient>
<lab>
<name>Diagnostics</name>
<type>Parent</type>
<cliaId>ere</cliaId>
<accessionPrefix>CT</accessionPrefix>
<effectiveFrom>20060828 00:00:00</effectiveFrom>
<providerState/>
<providerNumber/>
<specimenPartNaming>Alpha</specimenPartNaming>
</lab>
<referringPhysician>
<effectiveFrom>20061013 00:00:00</effectiveFrom>
<physicianName>
<first>AB</first>
<middleInitial/>
<last>Normal</last>
</physicianName>
<physicianId>dd</physicianId>
<email/>
<npi/>
<upin>dd</upin>
<orderDoubleSlides>false</orderDoubleSlides>
<alwaysTestMargins>false</alwaysTestMargins>
<credentials>MD</credentials>
<courierRoute/>
<isCopyTo>false</isCopyTo>
</referringPhysician>
<referringLocation>
<name>WART</name>
</Accession>
</DIRequest>[/HTML]
__________________________________________________ __________________


[HTML]<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="resultItem">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort data-type="number" select="typId" order="ascending"/>
<xsl:sort data-type="number" select="macroSequence" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>[/HTML]
Any help would be greatly appreciated.

DP
Jan 18 '07 #1
1 1163
r035198x
13,262 8TB
http://www.xmlfiles.com/xsl/xsl_sorting.asp
Jan 20 '07 #2

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

Similar topics

22
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b)...
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...
1
by: Leslie | last post by:
I'm running into a puzzling phenomenon with a datagrid. I have enabled sorting on a number of the columns. The sorting works fine on my development machine, but doesn't work at the client. The...
2
by: Li Pang | last post by:
Hi, I use a listview to populate the data, and define a sorting direction with Me.ListView1.Sorting = System.Windows.Forms.SortOrder.Ascending so far no problem. As long as I add a new row...
2
by: Chris Kratz | last post by:
We are having a weird problem that we ran into recently. If I use the following statements to create a test table and then run the select statement at the end, we get a very strange sort order. ...
8
by: simchajoy2000 | last post by:
I thought the only thing I had to do to disable column sorting in VB.NET was to set datagrid.AllowSorting = False. Unfortunately this has never worked for me. I discovered another set of code...
0
by: jobo | last post by:
Hey there, I'm having a problem getting sorting to work. Here's what the GridView looks like: "server" ID="updt1" Mode="Conditional">
1
by: bpd | last post by:
I am using SQLDataSource with a Gridview. I have sorting enabled on all (3) columns. When clicking on the column's sort hyperlink, nothing happens the first time. Clicking a second time will...
0
by: stainless | last post by:
Always have problems explaining issues on these forums but here goes (hope it makes some sense); I have created a recordset via a MapObjects Geodataset and SearchLayer function. The means by...
5
by: Mike | last post by:
I have several datagirds that allow sorting on two date columns. The sorting works but its not showing the newest date first when I sort. For example if I have dates in my column as 01/01/2008...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.