|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] getting a unique list using substring-after()
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








