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