[xsl] XSL returning only unique (non-duplicate) nodes

Subject: [xsl] XSL returning only unique (non-duplicate) nodes
From: "Todd Binder" <todd_binder@xxxxxxxxxxx>
Date: Mon, 29 Oct 2001 22:19:35 -0500
I am trying to use XSL to filter out all repeated records from a source XML
file below, so that I will only be working with a single instance of a given
show @id

when i use the following

 <xsl:variable name="unique-list"
select="//seminars/seminar[@nodeid=$nodeid]/schedule/show/@id[not(.=precedin
g::schedule/show/@id)]" />

I am able to get the correct 3 elements for @nodeid="1", but if I set
@nodeid="2", I get 0 elements

and when i reverse it (change preceding:: to following::)
 <xsl:variable name="unique-list"
select="//seminars/seminar[@nodeid=$nodeid]/schedule/show/@id[not(.=followin
g::schedule/show/@id)]" />

I get the opposite, 3 elements for @nodeid="2", but if I set @nodeid="1", I
get 0 elements

note: $nodeid is a <xsl:parameter> set to either 1 or 2

how do I limit the following:: and preceding:: to only look in the path that
I am specifying --> //seminars/seminar[@nodeid=$nodeid]/schedule/show <--
and not any other part of hte XML document?

source XML file
<seminars>
  <seminar nodeid="1">
     <schedule><show id="intro"/></schedule>
     <schedule><show id="pmw"/></schedule>
     <schedule><show id="ib"/></schedule>
     <schedule><show id="pmw"/></schedule>
   </seminar>
   <seminar nodeid="2">
     <schedule><show id="intro"/></schedule>
     <schedule><show id="ccr"/></schedule>
     <schedule><show id="ib"/></schedule>
     <schedule><show id="ccr"/></schedule>
   </seminar>
</seminars>



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


Current Thread