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="" xmlns:onion="" 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')}" />
conditional img tag

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