http://onionworks.net/2006/data/editing

setObjectPosition (target : xlink, position : int) : boolean

Elements can be moved within the structure. With the method “setObjectPostion”, an element can change position in its own hierarchy level.

The parameter position indicates where in the level the element is to be situated. “n-1” is to always be specified for the position. That means if an element is to move into first position, then a zero must be specified. In the same way, three would have to be specified for moving an element into final position in the case of four elements.

If the element has been successfully positioned, then “true” is returned. If it has not been positioned, say for example due to an invalid position indication, then “false” is returned.

The element can only be moved in the current hierarchy level. “moveObject” must be used for moving elements into other levels.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:edit="http://onionworks.net/2006/data/editing" xmlns:onion="http://onionworks.net/2004/data" version="1.0">
<xsl:template match="/">
<xsl:if test="edit:login('testuser', 'test')">
<xsl:choose>
<xsl:when test="edit:setObjectPosition(c.id(), 0)">The document was moved.</xsl:when>
<xsl:otherwise>The document could not be moved.</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="edit:logout()" />
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Positioning an element