<mm:content type="text/xml" expires="0"
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:jsp="http://java.sun.com/JSP/Page" 
     xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0"
     >
  <jsp:output omit-xml-declaration="true" />
  <mm:cloud rank="basic user">
    <mm:param name="org.mmbase.xml-mode" value="kupu" />

    <mm:import externid="objectnumber" required="true" />
    <mm:node id="node" referid="objectnumber">
      <mm:listrelationscontainer type="segments" role="index" searchdir="destination">
        <mm:maxnumber value="1" />
        <mm:sortorder field="pos" direction="down" />
        <mm:listrelations>
          <mm:field name="pos" id="pos" write="false"/>
        </mm:listrelations>
      </mm:listrelationscontainer>
    </mm:node>
    
    <mm:createnode id="segment" type="segments">
      <mm:setfield name="title">Nieuwe titel</mm:setfield>
    </mm:createnode>

    <mm:createrelation source="node" destination="segment" role="index">
      <mm:setfield name="pos">${pos + 1}</mm:setfield>
    </mm:createrelation>
    <info>Created ${node} -${pos +1}- ${segment}</info>
  </mm:cloud>
</mm:content>