Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Suppress repeating entries Suppress repeating entriesTo: 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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
