Xalan (the Transformer in Cocoon 2) uses the XSLT spec 1.0. But this doesn't matter for your problem. You don't need the nodeset()-function. With your variables you always get nodesets. The nodeset()-function is for transforming ResultTreeFragments to nodesets.
Now your problem: The problem is your code. In $myemp you store the scheduledates of the employee with id='43'. But the second variable $myemp1 selects only these nodes, where the value of the current node (scheduledate) is not the same like the value of the node named 'preceding' and child of scheduledate. I think all your scheduledates will fulfill this condition. What you obviously want, is something like the following: <xsl:variable name="myemp1" select="$myemp[. != preceding::scheduledate]"/> Or better/faster, because not so much nodes must be tested: <!-- never use '//' !! --> <!-- only the nodes /data/schedule have to be tested, not ALL nodes. --> <xsl:variable name="myemp" select="/data/schedule[employeeid='43']"/> <!-- only the preceding siblings have to be tested, not all preceding nodes. --> <xsl:variable name="myemp1" select="$myemp[not(scheduledate = preceding-sibling::schedule/scheduledate)]"/> <xsl:for-each select="$myemp1"> <xsl:value-of select="scheduledate"/><br/> </xsl:for-each> In my eyes the best method is using keys: <xsl:stylesheet .........> <!-- build an index over all schedules, group them by employeeid and scheduledate --> <xsl:key name="schedules" match="schedule" use="concat(employeeid,'::',scheduledate)"/> <xsl:template match="data"> <!-- for-each schedule-node, where the count of the nodes in the node-union of this node itself and the first node returned by the key-function is 1. This condition will only be fulfilled when '.' and 'key('schedules',concat(employeeid,'::',scheduledate))[1]' mean the same node --> <xsl:for-each select="schedule[count( . | key('schedules',concat(employeeid,'::',scheduledate))[1] )=1]"> <xsl:value-of select="scheduledate"/> </xsl:for-each> </xsl:template> </xsl:stylesheet> For more information on this grouping by keys (Muenchian Method), look at Jeni Tennison's site: http://www.jenitennison.com/xslt/grouping/muenchian.xml. Regards, Joerg ----- Original Message ----- From: "Mark S. Kent" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 13, 2001 12:28 AM Subject: C2 uses 1.0 or 1.1 of XSLT spec? > Does anyone have examples of the Xalan nodeset() function? I am having some > trouble. Does Cocoon2 use the 1.0 or 1.1 (a?) specification of XSLT? > > What I want to do is: > 1. Select nodes from my XML tree > 2. Create a variable of the unique dates within the selected nodes > > XML data looks like this: > <data> > <schedule> > <employeeid>70</employeeid> > <lastname>Smith</lastname> > <firstname>Susan</firstname> > <deptdesc>Training</deptdesc> > <scheduleid>275</scheduleid> > <scheduledate>06-11-2001</scheduledate> > <minutesscheduled>180</minutesscheduled> > </schedule> > <schedule> > <employeeid>70</employeeid> > <lastname>Smith</lastname> > <firstname>Susan</firstname> > <deptdesc>Training</deptdesc> > <scheduleid>276</scheduleid> > <scheduledate>06-11-2001</scheduledate> > <minutesscheduled>480</minutesscheduled> > </schedule> > <schedule> > <employeeid>70</employeeid> > <lastname>Smith</lastname> > <firstname>Susan</firstname> > <deptdesc>Training</deptdesc> > <scheduleid>277</scheduleid> > <scheduledate>06-12-2001</scheduledate> > <minutesscheduled>240</minutesscheduled> > </schedule> > </data> > XSL file looks like: > <?xml version="1.0"?> > > <xsl:stylesheet > version="1.0" > xmlns:xalan="http://xml.apache.org/xalan" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:template match="data"> > <!-- select only schedules for this emp --> > <xsl:variable name="myemp" > select="//schedule[employeeid='43']/scheduledate"/> > <!-- eliminate duplicate dates --> > <xsl:variable name="myemp1" select="$myemp[not(.=preceding)]"/> > <!-- display unique dates --> > <xsl:for-each select="$myemp1"> > <xsl:value-of select="."/><br/> > </xsl:for-each><br/> > </xsl:template> > > </xsl:stylesheet> > > "myemp" should be a nodeset of all schedules for employee "43". When I try: > <xsl:variable name="myemp1" select="$myemp[not(.=preceding)]"/> > it looks at ALL of the nodes in my XML (I think) rather than just the > sub-set I've chosen. Do I need to explicitly make a nodeset out of the > "myemp" selection? > > Mark --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>