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

createObject (parent : xlink, name : string, content : nodeset, [autoCheckIn : boolean]) : string

The method “createObject()” is used to produce new data objects. For example, new entries can be added to a guest book in this way.

The following example shows how such an entry can be made:

<xsl:stylesheet xmlns:app="http://onionworks.net/2006/data/application" xmlns:onion="http://onionworks.net/2004/schema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:variable name="parent">onion://data/objects/1</xsl:variable>
<xsl:variable name="name">Max Mustermann</xsl:variable>
<xsl:variable name="content">
<post onion:schema="Onion:http://www.getit.de/2007/guestbook/post"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit </post>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length(app:createObject($parent, $name, $content)) > 0"> The entry was saved. </xsl:when>
<xsl:otherwise> The entry could not be saved. </xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Adding a guest book entry

For the parameter xlink, the XLink of the element is specified under which the new object is to be created.

The content of the new element is transferred to the method as the third parameter in the form of an XML fragment. The schema describing this fragment must be specified in the root element of the fragment.

If the optional parameter “autoCheckIn” is not set, then the default value is “true”.