http://www.w3.org/1999/XSL/Transform

c.binaryMethodExists ([target : xlink], view : string) : boolean

The function binaryMethodExists tests, if a binary method exists for the given xlink. The underlying data type of the xlink is resolved and the template system searches for a method with the given name.

Testing for a method existence can be used to implement mechanisms similar to interfaces.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:onion="http://onionworks.net/2004/data" version="1.0">
<xsl:template match="/">
<xsl:variable name="target" select="'onion://data/objects/100'" />
<xsl:if test="c.binaryMethodExists($target, 'thumbnail')">
<img src="{c.binaryUri($target, 'thumbnail')}" />
</xsl:if>
</xsl:template>
</xsl:stylesheet>
conditional img tag

In this example an img tag is generated, if the reference object implements a method thumbnail.