Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Suppress repeating entries

From: GururajaKS@-----------.---------.---
To: NULL
Date: 3/15/2007 4:41:00 AM

I have the following xml

       <TestRequests>
          <TestRequest CollectionStatus="Resulted">
            <Category>Allergen</Category>
            <Specimen>
              <CollectedStartDT>
                <Value>2007-02-15T05:30:00.0000000+05:30</Value>
              </CollectedStartDT>
            </Specimen>
            <Results>
              <Observation>
                <Identifier>
		  <Code>1</Code>
                  <SpecimenType>AMN</SpecimenType>
                </Identifier>
              </Observation>
              <Observation>
                <Identifier>
		  <Code>2</Code>
                  <SpecimenType>AMN</SpecimenType>
                </Identifier>
              </Observation>
            </Results>
          </TestRequest>

          <TestRequest CollectionStatus="Resulted">
            <Category>Allergen</Category>
            <Specimen>
              <CollectedStartDT>
                <Value>2007-02-15T05:30:00.0000000+05:30</Value>
              </CollectedStartDT>
            </Specimen>
            <Results>
              <Observation>
                <Identifier>
 		<Code>3</Code>
                  <SpecimenType>BIFL</SpecimenType>
                </Identifier>
              </Observation>
            </Results>
          </TestRequest>


          <TestRequest CollectionStatus="Resulted">
            <Category>Allergen</Category>
            <Specimen>
              <CollectedStartDT>
                <Value>2007-02-15T05:30:00.0000000+05:30</Value>
              </CollectedStartDT>
            </Specimen>
            <Results>
              <Observation>
                <Identifier>
			<Code>4</Code>
                  <SpecimenType>AMN</SpecimenType>
                </Identifier>
              </Observation>
            </Results>
          </TestRequest>


          <TestRequest CollectionStatus="Resulted">
            <Category>Chem</Category>
            <Specimen>
              <CollectedStartDT>
                <Value>2007-02-15T05:30:00.0000000+05:30</Value>
              </CollectedStartDT>
            </Specimen>            
            <Results>
              <Observation>
                <Identifier>
			<Code>5</Code>
                  <SpecimenType>AMN</SpecimenType>
                </Identifier>
              </Observation>
            </Results>
          </TestRequest>


          <TestRequest CollectionStatus="Resulted">
            <Category>Allergen</Category>
            <Specimen>
              <CollectedStartDT>
                <Value>2007-02-14T05:30:00.0000000+05:30</Value>
              </CollectedStartDT>
            </Specimen>
            <Results>
              <Observation>
                <Identifier>
			<Code>6</Code>
                  <SpecimenType>AMN</SpecimenType>
                </Identifier>
              </Observation>
            </Results>
          </TestRequest>


        </TestRequests>



I am using the following key to group by Category,CollectedStartDate abd 
Specimen Type

<xsl:key name="TestRequestGroupByCategoryCollStDtandSpecimenType" 
match="*[local-name()='InquiryMessage']/*[local-name()='ResultSet']
/*[local-name()='Results']/*[local-name()='Order']/*[local-name()='TestRequests']/*[local-name()='TestRequest']
[@CollectionStatus='Resulted']" 
use="concat(*[local-name()='Category'],' ',
*[local-name()='Specimen']/*[local-name()='CollectedStartDT']/*[local-name()='Value'], ' ',
*[local-name()='Results']/*[local-name()='Observation']/*[local-name()='Identifier']/*[local-name()='SpecimenType'])"/>



<xsl:for-each 
select="*[local-name()='InquiryMessage']/*[local-name()='ResultSet']/*[local-name()='Results']
/*[local-name()='Order']/*[local-name()='TestRequests']/*[local-name()='TestRequest']
[generate-id(.) = 
generate-id(key('TestRequestGroupByCategoryCollStDtandSpecimenType',concat(*[local-name()='Category'], ' ',
*[local-name()='Specimen']/*[local-name()='CollectedStartDT']/*[local-name()='Value'], ' ',
*[local-name()='Results']/*[local-name()='Observation']/*[local-name()='Identifier']/*[local-name()='SpecimenType']))[1])]">


categories are sorted alphabetically
Collection Date/Time sorted descending order


			<xsl:variable name="categName">
				<xsl:value-of select="*[local-name()='Category']"/>
			</xsl:variable>
			<xsl:value-of select="$categName"/>
			
			....
			....
			....

</xsl:for-each>

The output is 

Currently
---------

Allergen
Collection Date/Time: 02/15/2007 00:00:00, Type:  AMN

Allergen
Collection Date/Time: 02/15/2007 00:00:00, Type:  BIFL

Allergen
Collection Date/Time: 02/14/2007 00:00:00, Type:  AMN

Chem
Collection Date/Time: 02/15/2007 00:00:00, Type:  AMN


How to suppess when the category in the grouping repeats to get the 
following output?

Expected
--------

Allergen
Collection Date/Time: 02/15/2007 00:00:00, Type:  AMN


Collection Date/Time: 02/15/2007 00:00:00, Type:  BIFL


Collection Date/Time: 02/14/2007 00:00:00, Type:  AMN

Chem
Collection Date/Time: 02/15/2007 00:00:00, Type:  AMN










transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent