o2xdl-core samples  3.01
Functions
a_rectangle.o2xSobj File Reference

CRectangle.a_rectangle: Simple o2x:object for contentList test. More...

Functions

 XML_code ()
 o2x:object code. More...
 

Detailed Description

This is a small o2x:object.

data
data defines width and height of a rectangle.
methods
CRectangle.area: the final method, calculates the rectangle Area
CRectangle.getFigure: getter for polygon name (late binding).
Returns
any context: A number, the area value

Function Documentation

◆ XML_code()

XML_code ( )

Simple implementation: data by value (o2x:body), methods by value (o2x:inline).

Note
: the method CPolygon.getFigure (public, late binding) is the same also in CTriangle.a_triangle.


-<o2x:object name="CRectangle.a_rectangle" xmlns:o2x="http://www.o2xdl.org/3.0/o2xdl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<o2x:dataValues>
-<o2x:body>
-<CRectangle>
<width>15</width>
<height>33</height>
<figure>Rectangle</figure>
</CRectangle>
</o2x:body>
</o2x:dataValues>
-<o2x:method visibility="final" context="default" key="CRectangle.area">
-<o2x:inline>
<xsl:output omit-xml-declaration="yes"/>
-<xsl:template match="o2x:object[@key='CRectangle.area']">
<xsl:value-of select="CRectangle/width * CRectangle/height"/>
</xsl:template>
</o2x:inline>
</o2x:method>
-<o2x:method visibility="public" key="CRectangle.getFigure">
-<o2x:inline>
-<!--
 late binding: CPolygon.getFigure = group id 
-->
-<xsl:template match="CRectangle" mode="CPolygon.getFigure">
<xsl:value-of select="figure"/>
</xsl:template>
</o2x:inline>
</o2x:method>
</o2x:object>