o2xdl-core samples  3.01
Functions
twopoly_complex08.o2xSobj File Reference

Complex o2x:object - 8: test a contentList size 2. More...

Functions

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

Detailed Description

Test for contentList use. This o2x:object is a container for two o2x:objects, a Triangle and a Rectangle.

data
This o2x:object has no data.
methods
Only one final method inline: "two_CPolygon.total_area"
Returns
An HTML fragment, with three lines: The area of first polygon, the area of second and the total area.

Function Documentation

◆ XML_code()

XML_code ( )

Visibility and contest are not required with only one method.
The Realization of objects in this contentList is as simple as <xsl:apply-templates select="o2x:contentList/o2x:object[1]</tt>" />

CORE constraint
In presence of o2x:contentList the methods of the container object (parent) are responsable for the correct realization of all (child) o2x:object in the list.


-<o2x:object name="two_poly" xmlns:o2x="http://www.o2xdl.org/3.0/o2xdl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<o2x:contentList>
<o2x:object URIref="file:///C:/o2xdl-30/CORE/samples/CPolygon/a_triangle.o2xSobj"/>
<o2x:object URIref="file:///C:/o2xdl-30/CORE/samples/CPolygon/a_rectangle.o2xSobj"/>
</o2x:contentList>
-<o2x:method key="two_CPolygon.total_area">
-<o2x:inline>
-<xsl:template match="o2x:object[@key='two_CPolygon.total_area']">
-<!--
 Realize of 2 objects in contentList: the list MUST contains exactly 2 polygons  
-->
-<xsl:variable name="area01">
<xsl:apply-templates select="o2x:contentList/o2x:object[1]"/>
</xsl:variable>
-<xsl:variable name="area02">
<xsl:apply-templates select="o2x:contentList/o2x:object[2]"/>
</xsl:variable>
-<!--
 using results from contentList 
-->
Areas:
<br/>
Triangle:
<xsl:value-of select="$area01"/>
<br/>
Rectangle:
<xsl:value-of select="$area02"/>
<br/>
<br/>
-<b>
Total:
<xsl:value-of select="$area01 + $area02"/>
</b>
</xsl:template>
</o2x:inline>
</o2x:method>
</o2x:object>