[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to remove duplicates nodes?

Subject: Re: How to remove duplicates nodes?
From: Joel Riedesel <jriedese@xxxxxxxxx>
Date: Fri, 25 Aug 2000 16:54:16 -0600
remove duplicate xml nodes
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@xxxxxxxxxxx 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@xxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.