o2xdl-core samples  3.01
Functions
minimal_object01.o2xSobj File Reference

Minimal o2x:object - 1: very basic sample. More...

Functions

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

Detailed Description

This is a small o2x:object for basic test.

data
Data is defined 'by value', i.e. into the <o2x:dataValues> tag.
methods
The unique method is defined 'by value', i.e. into the <o2x:method> tag.
Returns
An HTML fragment: the ship address formatted to print.

Function Documentation

◆ XML_code()

XML_code ( )

Implementation: data by value in <o2x:body> tag, method by value in <o2x:inline> tag.

CORE constraint
  • o2x:method: the attributes key is unique, and MUST be the same in all templates.
  • name attribute: in o2x:object, o2x:dataValues, o2x:method is optional.


-<o2x:object name="minimal_object01" xmlns:o2x="http://www.o2xdl.org/3.0/o2xdl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<o2x:dataValues>
-<o2x:body>
-<shipTo country="US">
<name>Kim Yoshida</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
</o2x:body>
</o2x:dataValues>
-<o2x:method key="OBJ.050511.M01">
-<o2x:inline>
-<!--
 standard final method template 
-->
-<xsl:template match="o2x:object[@key = 'OBJ.050511.M01']/shipTo">
-<!--
 no reuse: only one template 
-->
-<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>
<xsl:output omit-xml-declaration="yes"/>
</o2x:inline>
</o2x:method>
</o2x:object>