How about something like this, then? <xsl:variable name="m" select="/all/message"/>
<xsl:for-each select="$m[position()<6"> <xsl:sort select="."/> <!-- sample output here --> <xsl:value-of select="."/> </xsl:for-each> Or you might want to look at: http://www.dpawson.co.uk/xsl/sect2/N6461.html#d6361e489 Really you should ask this kind of question on the mulberrytech xsl list; you'll get more response! :-) Con > -----Original Message----- > From: Marcel Jurk [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 15 December 2002 18:52 > To: [EMAIL PROTECTED] > Subject: RE: RE: xsl:copy-of Problem > > > Hi Con, > > thanks for the hint with the RTF. But my problem is, > that I want first sort the elements and afterwards I > want output only the first five elements. > With your example > <xsl:variable name="m" select="/all/message"/> > is no sorting possible. > > Regards, > Marcel > > Marcel your variable $m holds a Result Tree > > Fragment, not a NodeSet. A RTF > > is not as useful as a nodeset. In particular you > > can't use "for-each" with > > it. > > > > See > > > http://www.w3.org/TR/xslt#section-Result-Tree-Fragments > > > > > > Try assigning the variable like this: > > <xsl:variable name="m" select="/all/message"/> > > > > Cheers! > > > > Con > > > > > -----Original Message----- > > > From: Marcel Jurk [mailto:[EMAIL PROTECTED]] > > > Sent: Saturday, 14 December 2002 07:16 > > > To: [EMAIL PROTECTED] > > > Subject: RE: RE: xsl:copy-of Problem > > > > > > > > > Sorry I forgott the following lines in the > > stylesheet. > > > > > > <xsl:template match="/"> > > > <xsl:variable name="m"> > > > <xsl:call-template name="sortmsg"/> > > > </xsl:variable> > > > <xsl:for-each select="$m"> > > > <xsl:value-of select="name(.)/> <!-- No output > > --> > > > <xsl:value-of select="."/> <!-- Output: > > msg1msg2 > > > --> > > > </xsl:for-each> > > > </xsl:template> > > > > > > <xsl:template name="sortmsg"> > > > <xsl:for-each select="/all/message"> > > > <xsl:copy-of select="."/> > > > </xsl:for-each> > > > </xsl:template> > > > > > > In the <xsl:for-each> loop must be the output two > > > times message, but I got no output and the loop is > > > pass only once. > > > I think that not the tree is copied with the > > > <xsl:copy-of> in the template sortmsg, but only > > the > > > values. > > > > > > Before the currently c2.1 (cvs 12.12) version, I > > used > > > c2.1 (cvs 30.10) and with it works fine, but now > > not. > > > > > > Marcel > > > > > > > --------------------------------------------------------------------- > > Please check that your question has not already > > been answered in the > > FAQ before posting. > > <http://xml.apache.org/cocoon/faq/index.html> > > > > To unsubscribe, e-mail: > > <[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <[EMAIL PROTECTED]> > > > > __________________________________________________________________ > > Gesendet von Yahoo! Mail - http://mail.yahoo.de > Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>