This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Listing single occurrences of namespace labels
- To: XSL-List at mulberrytech dot com
- Subject: Listing single occurrences of namespace labels
- From: Trem Stamp <trem at socialchange dot net dot au>
- Date: Wed, 29 Nov 2000 17:37:28 +1100
- Reply-To: xsl-list at mulberrytech dot com
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