o2xdl-core samples  3.01
Functions
simple_object07.o2xSobj File Reference

Simple o2x:object - 7: tests visibility and context. More...

Functions

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

Detailed Description

Test for methods calling: two 'final' methods calls the same 'private' method.

data
data are defined 'by reference', i.e. using a local file defined by URIref attribute in <o2x:dataValues> tag.
methods
In this o2x:object there are 3 methods:
  • OBJ.050511.M01, visibility final, context 'default'
  • OBJ.050512.M02, visibility final, context 'special'
    This method uses also a <o2x:paramValues>: more data, but private by method.
  • OBJ.050512.M03, visibility private, used by both 'final' methods to do the job.
Returns
  • default: An HTML fragment: the ship address formatted to print.
  • special: Same as default, but preceded by a courtesy phrase.(in o2x:paramValues).

Function Documentation

◆ XML_code()

XML_code ( )

Implementation: data on local file, method OBJ.050511.M01 by reference (local), method OBJ.050511.M02 inline with <o2x:paramValues> and method OBJ.050511.M03 private: this is used by both the other two methods >

CORE constraints
Method selection: In case of many methods, visibility and context are used as selectors by Realize(). Rules:
  • main object's method (unique): [visibility = 'final'] [and context=use_context]: Realize() binds the o2x:object to this method's key.
  • more useful methods: [visibility != 'final'] [and context=use_context]
  • all methods with context != use_context are not processed.


-<o2x:object name="minimal_object07" actualContext="none" xmlns:o2x="http://www.o2xdl.org/3.0/o2xdl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!--
  
          tests contexts: none|default|special
          If actualContext is not defined in o2x:object 
          MUST be definened in Realize()      
-->
<o2x:dataValues URIref="file:////C:/o2xdl-30/CORE/samples/minimal_object02_data.xml"/>
-<o2x:method key="OBJ.050511.M01" visibility="final" context="default">
-<o2x:inline>
-<xsl:template match="o2x:object[@key='OBJ.050511.M01']/shipTo">
-<!--
 only calls the private method (hearly binding)  
-->
<xsl:call-template name="OBJ.050511.M03"/>
</xsl:template>
</o2x:inline>
</o2x:method>
-<o2x:method key="OBJ.050511.M02" visibility="final" context="special">
-<!--
 parameters for OBJ.050511.M02 method 
-->
-<o2x:paramValues>
-<o2x:body>
-<!--
 this will be added to root: &lt;o2x:object> 
-->
<new_head>Dear customer</new_head>
</o2x:body>
</o2x:paramValues>
-<o2x:inline>
-<!--
 standard final method template 
-->
-<xsl:template match="o2x:object[@key = 'OBJ.050511.M02']">
-<!--
 first puts param value 
-->
<xsl:value-of select="new_head"/>
<br/>
-<!--
 calls private method (modal binding)  
-->
<xsl:apply-templates select="shipTo" mode="OBJ.050511.M03"/>
</xsl:template>
</o2x:inline>
</o2x:method>
-<o2x:method key="OBJ.050511.M03" visibility="private">
-<o2x:inline>
-<!--
 standard modal + hearly binding, for max reuse 
-->
-<xsl:template match="shipTo" name="OBJ.050511.M03" mode="OBJ.050511.M03">
-<b>
<xsl:value-of select="name"/>
</b>
<br/>
<xsl:value-of select="street"/>
<br/>
<xsl:value-of select="city"/>
,
<xsl:value-of select="state"/>
<xsl:value-of select="zip"/>
<br/>
<xsl:value-of select="@country"/>
</xsl:template>
</o2x:inline>
</o2x:method>
</o2x:object>