This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Distinct list problem
- From: Henk Meulekamp <henkm at ccni dot nl>
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 18 Jan 2002 14:53:12 +0100
- Subject: [xsl] Distinct list problem
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
I'm trying to get a list of id's where each id is represented once out of
the xml below. Is it possible? The stylesheet below gives me:
20
21 - 20
21
20 - 21
22
21 - 22
20 - 22 - 21
21
20 - 21
So I get what I want, but then on anchestor based distinct. And not for all
attributequalitiy elements in the document. Should I make use of the msxml
nodeset function to construct a intermediate nodeset?
The ouput I want is:
20
21
22
Many thnx
Grt Henk Meulekamp
//-----------------------xsl
<xsl:variable name="attributes"
select="/root/page/ATTRIBUTES/CONTRACT//ATTRIBUTEQUALITY"/>
<xsl:for-each select="$attributes[not(@IDTESTTYPE =
preceding-sibling::ATTRIBUTEQUALITY/@IDTESTTYPE)]">
<br/>run -<xsl:value-of select="@IDTESTTYPE"/>
<xsl:for-each select="preceding-sibling::ATTRIBUTEQUALITY">
- <xsl:value-of select="@IDTESTTYPE"/>
</xsl:for-each>
</xsl:for-each>
'//----------------------xml
<CONTRACT IDCONTRACT="2" CCONTRACTNUMBER="1.1" CPRODUCT="JORISTEST"
DECQUANTITY="1000.000" CUNIT="MT">
<DELIVERY IDDELIVERY="1" NUMLOADINGASSIGNMENT="1" IDTESTREPORT="2">
<ATTRIBUTEQUALITY IDTESTTYPE="20" />
<ATTRIBUTEQUALITY IDTESTTYPE="21" />
</DELIVERY>
<DELIVERY IDDELIVERY="2" NUMLOADINGASSIGNMENT="1234" IDTESTREPORT="1">
<ATTRIBUTEQUALITY IDTESTTYPE="21" />
<ATTRIBUTEQUALITY IDTESTTYPE="20" />
<ATTRIBUTEQUALITY IDTESTTYPE="21" />
<ATTRIBUTEQUALITY IDTESTTYPE="21" />
<ATTRIBUTEQUALITY IDTESTTYPE="20" />
</DELIVERY>
<DELIVERY IDDELIVERY="4" NUMLOADINGASSIGNMENT="4" IDTESTREPORT="20">
<ATTRIBUTEQUALITY IDTESTTYPE="22" />
<ATTRIBUTEQUALITY IDTESTTYPE="21" />
<ATTRIBUTEQUALITY IDTESTTYPE="20" />
</DELIVERY>
<DELIVERY IDDELIVERY="6" NUMLOADINGASSIGNMENT="6" IDTESTREPORT="23">
<ATTRIBUTEQUALITY IDTESTTYPE="21" />
<ATTRIBUTEQUALITY IDTESTTYPE="20" />
</DELIVERY>
</CONTRACT>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list