XML Block

Purpose

Defines how a Web page is to be presented in XML-enabled Web clients. The name of the XML block to be executed is specified on the URL when Net.Data is invoked. The XML block can contain most Net.Data macro language statements and any XML content.

Syntax

>>-%XML----(--name--)------------------------------------------->
 
                     .--------------------------.
                     V                          |
>-----{--XML prolog-----+--------------------+--+---%}---------><
                        +-variable reference-+
                        +-if block-----------+
                        +-function call------+
                        +-XML statement------+
                        +-include statement--+
                        '-while block--------'
 

Values

%HTML
The keyword that specifies the block that contains HTML tags and text to be displayed on the client's browser.

name
An alphabetic or numeric string that begins with an alphabetic character or underscore and contains any combination of alphabetic, numeric, or underscore characters, including periods.

XML prolog
Insert an XML prolog, declaring any stylesheets, DTD's or other requirements for your XML document. The detailed format of an XML prolog is defined at http://www.w3.org/TR/1998/REC-xml-19980210. The following is an example of a basic prolog using one of the Net.Data provided stylesheets:

<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="ndTable.xsl" ?>

variable reference
Returns the value of a variable and is specified with $ and (). For example: if VAR='abc', then $(VAR) returns the value 'abc'. See Variable Reference for syntax information.

if block
The IF block. Performs conditional string processing. String values in the condition list are treated as numeric for comparisons if they are strings that represent integers and have no leading or trailing white space. They can have a single leading plus (+) or minus (-) sign. See IF Block for syntax and examples.

function call
Invokes one or more FUNCTION or MACRO_FUNCTION blocks, or a Net.Data built-in function with specified arguments. See Function Call (@) for syntax and examples.

XML statements
Includes any XML that is simply well-formed or also complies with the DTD or stylesheet you might have specified in the XML prolog.

include statement
The INCLUDE statement. Reads and incorporates a file into the Net.Data macro. See INCLUDE Statement for syntax and examples.

while block
The WHILE block. Performs looping with conditional string processing. See WHILE Block for syntax and examples.

Context

The XML block can be found in these contexts:

Restrictions

The XML block can contain these elements:

Examples

Example 1. An XML block including a standard prolog and calling a function:

%XML(report3){
%INCLUDE "style3header.xml"
<title>Results</title>
<XMLBlock>
@xmp1()
</XMLBlock>
%}

Example 2. xmp1() could be defined to return a small result set from an SQL query:

%FUNCTION DTW_SQL xmp1() {
  SELECT LASTNME,EMPNO FROM EMPLOYEES
  WHERE LASTNME LIKE 'M%'
%}
 
%XML(report3){
<xml version="1.0" ?>
<xml-stylesheet type="text/xsl" href="ndReport.xsl" ?>
<title>Results</title>
<XMLBlock>
@xmp1()
</XMLBlock>
%}
 

The following output would be produced:

Content Type: text/xml
 
<xml version="1.0" ?>
<xml-stylesheet type="text/xsl" href="ndReport.xsl" ?>
<title>Results</title>
<XMLBlock>
<RowSet>
  <Row number="1">
    <Column name="LASTNME">Mason</Column>
    <Column name="EMPNO">520</Column>
  </Row>
  <Row number="2">
    <Column name="LASTNME">Masse</Column>
    <Column name="EMPNO">559</Column>
  </Row>
  <Row number="3">
    <Column name="LASTNME">Mercury</Column>
    <Column name="EMPNO">312</Column>
  </Row>
</RowSet>
</XMLBlock>
 


[ Top of Page | Previous Page | Next Page | Index ]