|
Subject: [xsl] filtering and removing duplicated info From: Juan Pablo Ramïrez Pïrez <silverfox@xxxxxxxxx> Date: Mon, 29 Aug 2005 15:25:05 +0200 |
Hello all. I'm working with an xml defining objects, like this:
<DATA>
<OBJECTS>
<OBJECT class="one_class">
<TYPE cmb1="xxx" cmb2="yyy" ... cmb8="zzz">
</OBJECT>
<OBJECT class="another_class">
<TYPE cmb1="aaa" cmb2="asd" ... cmb7="jjj">
<TYPE cmb1="bbb" cmb2="adr" ... cmb7="kkk">
<TYPE cmb1="ccc" cmb2="rty" ... cmb7="tyr">
<TYPE cmb1="ccc" cmb2="qwe" ... cmb7="qwe">
</OBJECT>
...
</OBJECTS>
</DATA>
I'm filtering for class and / or any cmbX attributes (I'm creating <OPTION>
tags with no duplicated options for a web page and only remaining options
for actual filter in all other combos):
<xsl:variable name="unfiltered_var" select="/DATA/OBJECTS/OBJECT>
<xsl:variable name="filtered_var_obj"
select="$unfiltered_var[VEH/@cmb1=$actual_selection_in_cmb1][and
so on]/>
<xsl:variable name="filtered_var_cmb1"
select="$unfiltered_var[@class=$actual_selection_in_class]/VEH[VEH/@cmb2=$act
ual_selection_in_cmb2][and
so on]/>
All the same for all combos
Now, I need remove duplicated attributes for all filtered variables. I used
keys, but doesn't work. In
http://www.dpawson.co.uk/xsl/sect2/N2696.html#d3983e16
is all info about duplicates, but it doesn't works for me:
If I've only one OBJECT node, it works perfectly with following-sibling,
using:
<xsl:variable name="filtered_without_duplicates"
select="$filtered_var_cmbX[not(@cmbX=following-sibling::node()/@litmotor)]"/>
<xsl:for-each select="$filtered_without_duplicates">
<xsl:value-of select="@cmbX"/>
</xsl:for-each>
But it doesn't work when filtered_without_duplicates contains more than
1 OBJECT node. Following works properly when filtered_var_cmbX is equal
to //DATA/OBJECTS/OBJECT/TYPE (whitout filter)
How can I apply all my filters and then remove duplicated values? (I'm using
a generic MSXML parser and XSLT ver 1.0)
Thanks for all your answers.
Silverfox
Internet, Intranet y extranet.?Quieres saber en qui se diferencian?
Toda la infomacisn sobre el mundo de la tecnologma.
http://tecnologia.tiscali.es/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XSLT sheets for Flexiondo, Joris Gillis | Thread | [xsl] Usage scenarios of 'treat as', Frans Englich |
| Re: [xsl] Re: Lightweight XSLT base, James Fuller | Date | [xsl] import/include with xsl:varia, Dominik Zayer |
| Month |