c.literalCall ([target : xlink], method : string, [name : string, value : string]*) : string

The function literalCall allows you to execute a method on a remote object and utilize the rendering result.

An xlink or a method name can be given as a parameter. The method name is optional if an xlink has been given without further parameters (name, value).

<xsl:stylesheet xmlns:xsl="" xmlns:onion="" version="1.0">
<xsl:template match="/">
<xsl:value-of select="c.literalCall('onion://data/objects/100', 'teaser')" />
<xsl:variable name="teaser" select="c.literalCall('onion://data/objects/100', 'teaser','mode', 'large', 'border', 'yes')" />
<xsl:if test="string-length($teaser) > 0">
<xsl:value-of select="$teaser" disable-output-escaping="yes" />
Performing a literal call

The first example executes the method teaser and prints the result into the output.

The second example executes the method teaser with the arguments mode and border and stores the result in a variable. If the result was not empty, a headline is placed before the teaser content.

Literal output may contain html or xml data. Due to xml conformance, textual data written into the output document will be escaped. By adding the attribute disable-output-escaping="yes" to the value-of element, the output is written as a raw value into the xml based stream.

The following example utilitizes the tag variant of a literalCall:

<c.literalCall id="onion://data/objects/100" method="teaser" />
<c.literalCall id="onion://data/objects/100" method="teaser" mode="large" border="yes" />
<c.literalCall xsl-variable="content" method="content" />
<xsl:value-of select="string-length($content)" />
Performing a tag based literal call

The tag variant is the usual way to embed literal output of a remote method. The attributes id and method are reserved. If no method name is given, the system implies the method name default. If no id is specified, the current object of the rendering context will be used.

The tag based variant allows conditional arguments:

<xsl:variable name="teasersRequireBorder" select="false()" />
<c.literalCall id="onion://data/objects/100" method="teaser" mode="large">
<xsl:if test="$teasersRequireBorder">
<xsl:attribute name="border">yes</xsl:attribute>
Conditional argument in a literal call

In this example, the argument is specified, if the variable teasersRequireBorder contains the value true.