o2xdl-core samples  3.01
Functions
simple_object06.o2xSobj File Reference

Simple o2x:object - 6 : test for o2x:paramValues, context. More...

Functions

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

Detailed Description

Test of methods selection via 'context' and use of <o2x:paramValues>

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 are 2 methods:
  • OBJ.050511.M01: context 'default'.
  • OBJ.050511.M02: context 'special' . This method uses a <o2x:paramValues>: more data, but private by method
Returns
  • context = 'default': An HTML fragment: the ship address formatted to print.
  • context = 'special': Same as 'default', but preceded by a courtesy phrase.(in o2x:paramValues).

Function Documentation

◆ XML_code()

XML_code ( )

Implementation: data is in local file, method OBJ.050511.M01 is defined by local reference, method OBJ.050511.M02 is inline with .<o2x:paramValues>

paramValues
At runtime, the data in all o2x:paramValues become child of the o2x:object</ tt> tag, like all o2x:dataValues contents: be careful that root tags are different to avoid conflicts.
CORE constraints
Context: precedence rules ('none' is the neutral value):
  • the default context, defined in o2xdl environment (file o2xdl-system.xml).
  • the runtime context, defined by Realize().
  • the parent's context, for an o2x:objets present in an o2x:contentList (if any).
  • the private context, defined in o2x:objets/@context


-<o2x:object name="simple_object06" actualContext="none" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:o2x="http://www.o2xdl.org/3.0/o2xdl">
-<!--
  
          tests actualContext: none|default|special 
-->
<o2x:dataValues URIref="file:////C:/o2xdl-30/CORE/samples/minimal_object02_data.xml"/>
<o2x:method key="OBJ.050511.M01" context="default" URIref="file:////C:/o2xdl-30/CORE/samples/minimal_object02_method.xsl"/>
-<o2x:method key="OBJ.050511.M02" context="special">
-<o2x:paramValues>
-<o2x:body>
-<!--
 param root: new_head, data root: shipTo == ok 
-->
<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']/shipTo">
<xsl:value-of select="../new_head"/>
<br/>
-<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>