This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to remove duplicates nodes?
- To: xsl-list at mulberrytech dot com
- Subject: Re: How to remove duplicates nodes?
- From: Joel Riedesel <jriedese at jnana dot com>
- Date: Fri, 25 Aug 2000 16:54:16 -0600
- Organization: Jnana Technologies Corporation
- References: <85256946.00732A0C.00@cch_lis_smtp.cch-lis.com>
- Reply-To: xsl-list at mulberrytech dot com
Ok, I believe I'm beginning to understand this stuff, enough
to think that I've got a legitimate difficulty here:
I've got an abstract concept of a rule mapping. This thing has
multiple rule elements in it, each of which have multiple RHS.
A rule mapping is an overall 'rule' of sorts, each rule element being
a particular part of it.
I want to find all the 'Context' elements that are being set by
a rule mapping. To do so, I go to a RuleMapping element and
from there find all the "Rule/RHS/Context[1]" Context elements.
That's where there may be duplicates.
Doing a [not(.=following::Context)] doesn't work since the 'following',
if I'm correct, is at the rule mapping node that I happen to
be sitting in and isn't referring to the particular nodes in
the node set from my main path expression.
I don't believe I can use the 'key' trick since the Context element
is throughout my XML and I only want to do this duplicate analysis
from within a particular rule mapping element.
Here is some sample extract of my xml showing two rule mappings.
For the first I should end up with three Context elements with which
I can then display them. From the second, only one Context element.
Really, I think this is trickier that it seems (or I'm being really
stupid!). Thanks for any help!
<RuleMapping id="626" name="from+bike+type+to+relevants+of+other+issues" issueid="131">
<RHS>
<Context>
<ObjectReference objectID="152" attributeGroupID="153" instanceID="0" attributeID="154"/>
</Context>
<Constant attributeid="154">
<DataValues><DataValue><Top><Boolean value="false"/></Top><Bottom><Boolean value="false"/></Bottom></DataValue></DataValues></Constant>
</RHS>
</Rule>
<Rule id="628" name="from+bike+type+to+relevants+of+other+issues" issueid="131" situationid="304">
<RHS>
<Context>
<ObjectReference objectID="136" attributeGroupID="137" instanceID="0" attributeID="138"/>
</Context>
<Constant attributeid="138">
<DataValues><DataValue><Top><Boolean value="true"/></Top><Bottom><Boolean value="true"/></Bottom></DataValue></DataValues></Constant>
</RHS>
</Rule>
<Rule id="629" name="from+bike+type+to+relevants+of+other+issues" issueid="131" situationid="306">
<RHS>
<Context>
<ObjectReference objectID="140" attributeGroupID="141" instanceID="0" attributeID="142"/>
</Context>
<Constant attributeid="142">
<DataValues><DataValue><Top><Boolean value="false"/></Top><Bottom><Boolean value="false"/></Bottom></DataValue></DataValues></Constant>
</RHS>
</Rule>
</RuleMapping>
<RuleMapping id="601" name="from+recreational+riding+and+road+conditions+to+bike+type" issueid="131">
<Properties>
</Properties>
<Rule id="602" name="from+recreational+riding+and+road+conditions+to+bike+type" issueid="131" situationid="235">
<RHS>
<Context>
<ObjectReference objectID="131" attributeGroupID="132" instanceID="0" attributeID="135"/>
</Context>
<Context>
<ObjectReference objectID="136" attributeGroupID="137" instanceID="0" attributeID="138"/>
</Context>
</RHS>
</Rule>
<Rule id="603" name="from+recreational+riding+and+road+conditions+to+bike+type" issueid="131" situationid="255">
<RHS>
<Context>
<ObjectReference objectID="131" attributeGroupID="132" instanceID="0" attributeID="135"/>
</Context>
<Context>
<ObjectReference objectID="136" attributeGroupID="137" instanceID="0" attributeID="138"/>
</Context>
</RHS>
</Rule>
<Rule id="604" name="from+recreational+riding+and+road+conditions+to+bike+type" issueid="131" situationid="225">
<RHS>
<Context>
<ObjectReference objectID="131" attributeGroupID="132" instanceID="0" attributeID="135"/>
</Context>
<Constant attributeid="135">
<DataValues><DataValue><Top><List value="1"/></Top><Bottom><List value="1"/></Bottom></DataValue></DataValues></Constant>
</RHS>
</Rule>
</RuleMapping>
Michal_Mart@cch-lis.com wrote:
>
> Hi Joel,
> Will this work:
> <xsl:template match="/">
>
> <xsl:for-each
> select="rule/rhs/value[1][not(.=following::rhs/value[1])]">
>
> <xsl:value-of select="."/>
>
> </xsl:for-each>
>
> </xsl:template>
>
> HTH,
> Michal
>
--
Joel Riedesel
Jnana Technologies Corporation
mailto:jriedese@jnana.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list