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

getting a unique list using substring-after()

Subject: getting a unique list using substring-after()
From: Aedemar Cooke <Aedemar.Cooke@xxxxxxxxxx>
Date: Thu, 1 Feb 2001 16:19:40 -0000
javascript unique list
Hi,
I am trying to get a list of resource ids from the below XML where only one
entry with the same sub-id (numbers after the - in the @id attribute)
appears

<related>
	<content>
		<resource id="66237-89002" displayText="test1"
date_of_entry="Mar 3"/>
		<resource id="66237-89006" displayText="test1"
date_of_entry="Mar 3"/>
		<resource id="66237-87005" displayText="First entry"
date_of_entry="Mar 3"/>
		<resource id="66238-89002" displayText="test1"
date_of_entry="Mar 3"/>
		<resource id="66238-89006" displayText="test1"
date_of_entry="Mar 3"/>
		<resource id="66238-87005" displayText="First entry"
date_of_entry="Mar 3"/>
	</content>
	<product />
</related>

If I wanted to get a unique list dependent on @displayText then I could use
this code
<xsl:variable name = "unique-resources2"
select="//navigation_page/navigation/related/content/resource[not(@displayTe
xt=preceding-sibling::resource/@displayText)]"></xsl:variable>

	<resource id="66237-89002" displayText="test1" date_of_entry="Mar
3"/>
	<resource id="66237-87005" displayText="First entry"
date_of_entry="Mar 3"/>

can anyone explain why using the substring-after function
<xsl:variable name = "unique-resources"
select="//navigation_page/navigation/related/content/resource[not(substring-
after(@id,'-')=substring-after(preceding-sibling::resource/@id,'-'))]"></xsl
:variable>

yields

	<resource id="66237-89002" displayText="test1" date_of_entry="Mar
3"/>
	<resource id="66237-89006" displayText="test1" date_of_entry="Mar
3"/>
	<resource id="66237-87005" displayText="First entry"
date_of_entry="Mar 3"/>
	<resource id="66238-89006" displayText="test1" date_of_entry="Mar
3"/>
	<resource id="66238-87005" displayText="First entry"
date_of_entry="Mar 3"/>

and not
	<resource id="66237-89002" displayText="test1" date_of_entry="Mar
3"/>
	<resource id="66237-89006" displayText="test1" date_of_entry="Mar
3"/>
	<resource id="66237-87005" displayText="First entry"
date_of_entry="Mar 3"/>









 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-2013 All Rights Reserved.