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

Listing single occurrences of namespace labels

Subject: Listing single occurrences of namespace labels
From: Trem Stamp <trem@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Nov 2000 17:37:28 +1100
scary names for a book
HI all,

I'm not sure that my last question got sent properly....so here it is
again.

I'd like to know if it is possible to generate a list of namespace label
values that may occur in an xml,
so that only one label reference occurs even if there are two or more of
the same name.

For example if I have....

<library xmlns="http://www.examples.org"
xmlns:book="http://www.book.com" >
<book>
   <book:horror>
 <name>Franknstein</name>
   </book:horror>
</book>
<book>
   <book:horror>
 <name>Scary movies</name>
   </book:horror>
<book>
   <book:action>
 <name>James Bond</name>
   </book:action>
</book>
</library>


I'd like to list:

<book>
   horror
   action
</book>

(note only one mention of horror is listed).

I've been through the XSL-list and know that it is possible to list
unique values using preceding-sibling,
but couldn't get it to work when trying to use the local-name() as the
checking value.

It may have been the incorrect syntax:


<xsl:template match="/library">
<book>
 <xsl:apply-templates select="book[not(local-name(*//.) =
preceding-sibling::*//local-name(.))]"/>
</book>
</xsl:template>


<xsl:template match="book">
<xsl:value-of select="local-name(*//.)"/>
</xsl:template>


Firstly can anyone suggest where I am going wrong.

Secondly what if the books aren't necessarily in the correct order for
preceding-sibling to work correctly.
Is there any other way that I can retrieve only single values of
namespace elements?


Cheers,

Trem


 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.