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]>