Subject: Re: [xsl] key() and ordering of resulting node-set From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx> Date: Thu, 16 Nov 2006 12:02:03 +0000 |
Michael Kay wrote: >> XT is putting the menus in reverse order. > > Show us some code, and we can tell you if you've found a bug in XT. > I'm leaving out the bulk of the code, because it's not interesting, and I don't think it's important for this problem. 'artifact-entry-actions' should produce an <a> element with onmouseover/out actions to call up the appropriate menu. The appropriate menu is selected by position(). the code generateing menus uses position() too, but the ordering comes from the result of key(). I hope it's clear how these templates match up with each other. The code generating the item listing (will be in document order, yes?): <xsl:template name="get-all-entries"> <xsl:apply-templates select="ARTIFACT/ARTIFACT"/> </xsl:template> ------------------------- <xsl:template name="artifact-entry-actions"> <xsl:param name="notifyextra" select="0"/> <xsl:variable name="pos" select="position()+$notifyextra+6"/> <A HREF="javascript:void(null)" onMouseOver="{concat('BC_PopUp(', $snglq, $pos, $snglq, ',event); return true')}" onMouseOut="{concat('BC_PopDown(', $snglq, $pos, $snglq, '); return true')}"> <IMG WIDTH="13" HEIGHT="13" BORDER="0" ALT="Click for Actions" NAME="{concat('menu', $pos)}"> <xsl:attribute name="SRC"> <xsl:value-of select="$ImgDir"/> <xsl:text>act_</xsl:text> <xsl:choose> <xsl:when test="contains(ACTIONS/ACTION[@name='inf']/@icon,'blue')"> <xsl:text>blue</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>grey</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>.gif</xsl:text> </xsl:attribute> </IMG> </A> <xsl:text> </xsl:text> </xsl:template> --------------------------- The code generating the menus: <xsl:key name="artifact_id-subartifacts" match="//ARTIFACT/ARTIFACT" use="../@id"/> --------------------------- {This is in a template:} <xsl:for-each select="key('artifact_id-subartifacts', $root_artifact_id)"> <xsl:text>HM_Array</xsl:text> <xsl:value-of select="position()+6"/> <xsl:text> = [[120,]</xsl:text> <!-- Generate menu javascript here. --> </xsl:for-each> I believe I have included the pertinent sections... # r -- Ronan Klyne Business Collaborator Developer Tel: +44 (0)870 163 2555 ronan.klyne@xxxxxxxxxxx www.groupbc.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] key() and ordering of res, Michael Kay | Thread | RE: [xsl] key() and ordering of res, Michael Kay |
RE: [xsl] key() and ordering of res, Michael Kay | Date | RE: [xsl] key() and ordering of res, Michael Kay |
Month |