[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: key() and ordering of resulting node-set

Subject: Re: key() and ordering of resulting node-set
From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx>
Date: Thu, 16 Nov 2006 12:02:03 +0000
Re:  key() and ordering of resulting node-set
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>&#160;</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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.