| Style Concepts | Table of contents | Indexes | Implementing a Link Editor | |||
Guidelines for using XML for Electronic Data Interchange |
|
Martin Bryan |
| The SGML Centre |
Guidelines for using XML for Electronic Data Interchange |
|
Version 0.06 |
9th March 1998 |
Editor: Martin Bryan , The SGML Centre |
Contributors: Members of the XML/EDI working group, including Benoít Marchal, Norbert H Mikula, Bruce Peat and David RR Webber. |
XML/EDI Group Home Page URL: |
<A HREF="http://www.xmledi.net"> http://www.xmledi.net</A> |
Copyright © 1998. XML/EDI Group. All rights reserved, no part of this document may be commercially reproduced in part or in whole without consent and prior approval. |
Changes made to this version |
|
Typographical corrections only |
Contents |
|
1. Purpose & Goal of the XML/EDI Guidelines |
|
Put simply, the goal of XML/EDI is to deliver unambiguous and durable business transactions via electronic means. |
2. Definitions for XML/EDI |
|
The Electronic Enterprise |
![]() |
The standards involved in XML/EDI |
|
In October 1997 a specification for a formal Document Object Model (DOM) for XML documents was published by W3C. This model provides a standardized API for XML-based tools. |
The XML/EDI Group is not creating a new standard. XML/EDI is about defining how companies can use current standards and best business practices to solve their business problems. |
3. Scope of XML/EDI |
|
Details of the scope of XML/EDI, and the impact it is expected to have on business communities, are covered in our introductory paper on |
<A HREF="http://www.xmledi.net"> <CIT>Introducing XML/EDI...</CIT></A>. |
Business-to-business Electronic Data Interchange |
|
Electronic Commerce in 1997 |
![]() |
Electronic business transactions |
|
To be truly interactive you need to be able to: |
To do this you need to be able to: |
When DataBots are being used XML/EDI is identified as being robot generated by adding an R to its name to become XML/EDI-R. |
At this point in time the ECMAScript subset of the Java programming language provides the vehicle that permits the DataBots to be deployed and received along with XML/EDI messages. |
Future based on XML/EDI |
![]() |
4. Base Technologies of XML/EDI |
|
XML/EDI is a synthesis of many concepts. XML/EDI: |
XML/EDI can be seen as the fusion of five existing technologies: |
The Five Technologies of XML/EDI |
![]() |
Why use XML? |
|
In 1986 the International Organization for Standardization (ISO) published an international standard defining a Standard Generalized Markup Language (SGML) that allowed its users to: |
XML provides an ideal methodology for electronic business because: |
Integrating XML with EDI |
|
XML can be integrated with existing EDI systems by: |
XML can extend existing EDI applications by: |
5. XML/EDI Components |
|
The following figure illustrates the main layers of a fully integrated XML/EDI system. |
The layers of an XML/EDI system |
![]() |
The XML/EDI specific components are built on top of existing standards for transmitting and processing XML-encoded data. These standards define shared features such as: |
Types of applications |
|
The following examples of the type of facilities that could be built into an XML/EDI implementation isn't comprehensive, but a starting place for discussion: |
Each of these options is explained in more detail in the following subsections. |
Lexicon Repositories |
|
A primary component of XML/EDI is its dynamic common language and syntax repository. The various type of repositories include: |
XML/EDI Data Manipulation Agents (DataBots) |
|
The central goals behind the development of the concept of DataBots are: |
All these goals are realizable using XML/EDI-R. |
![]() |
DataBots and their associated XSL scripts provide facilities that allow XML/EDI systems to: |
Note:
|
In summary, the optional DataBots component provides the agent that brokers, controls, corrects, directs and ensures that the XML/EDI-R method can progress information transfers correctly. |
XML/EDI Business Objects |
|
Below are just a few examples of the many possible classes of XML/EDI business objects: |
XML/EDItors |
|
XML/EDI extensions for message stores |
|
Search Agents |
|
Trading Partner Pages |
|
6. The Implementation Process |
|
Using XML for Electronic Data Interchange |
|
The following stages are involved in using XML for the interchange of commercial EDI messages: |
An application does not need to use all of the levels of processing shown in and the above list: it can stop at whichever level in the hierarchy suits it. For example, an application can confine itself to checking incoming and outgoing EDI messages using a document object model that has been formally defined in an XML DTD. |
Identifying data sets |
|
Developing DTDs |
|
Warning: The following text presumes some knowledge of SGML and/or XML. |
XML DTDs can be developed by: |
Declarations that form a standardized XML DTD will typically be stored in separate files, which can be referenced, as an XML external subset, by those wishing to use it through the Internet Uniform Resource Locator that its originator has assigned to a publicly available copy of the data. Alternatively, if public access is to be restricted, the document type definition can be stored as the internal subset within the document type definition sent with the message. |
Where the document type definition is based on classes of information shared by more than one message, each class of information can be defined in a separate file, known in XML as an external entity, these files being referenced in a suitable sequence from within the external or internal subset of the XML DTD. |
For example, an XML DTD could have the form: |
<!ENTITY % address SYSTEM "http://www.myco.org/messages/XML/address.xml"> <!ENTITY % items SYSTEM "http://www.edifact.org/messages/XML/items.xml"> <!ENTITY % data "(#PCDATA)"> <!ELEMENT order (order-no, deliver-to, invoice-to, item+) > <!ELEMENT order-no %data; > <!ELEMENT deliver-to (address) > <!ELEMENT invoice-to (address) > <!--Import standard address class--> %address; <!--Import standard item class--> %items; |
This DTD fragment defines two external and one internal parameter entity, four locally defined elements and contains two parameter entity references ( %address; and %items; ) that call in the contents of the external entities at appropriate points in the definition. Both of the parameter entity references are preceded by explanatory comments. |
Note that the source of each class of information is identified not in the call to the class itself ( %address; ) but within a formal definition of the data storage entities required to process the class definition references (e.g. the first two lines of the DTD). This technique allows files to be moved without having to change the main definition of the DTD. |
Typically the entity definitions will be stored outside the DTD, which will contain a reference to the URL of the point at which the latest details of library file locations can be found. For example: |
<!ENTITY % library SYSTEM "http://www.myco.org/messages/XML/library.ent"> %library; <!ELEMENT order (order-no, deliver-to, invoice-to, item+) > <!ELEMENT order-no %data; > <!ELEMENT deliver-to (address) > <!ELEMENT invoice-to (address) > <!--Import standard address class--> %address; <!--Import standard item class--> %items; |
where %library; references a file containing the entity definitions given at the start of the previous example. |
XML provides (experimental) facilities for ensuring that data modules taken from libraries do not introduce name clashes in their elements. The names of elements within each module can be qualified by a module (namespace) identifier. Each namespace identifier can be associated with a URL that uniquely identifies where the module is formally defined. For example, the contents of the library file referenced above could be defined as: |
<?xml-namespace href="http://www.ebes.org/XML/EDI-address.xml" as="address"?> <?xml-namespace href="http://www.ean-fora.org/XML/order-items.xml" as="items"?> <!ENTITY % data "(#PCDATA)"> <!ENTITY % address " <!ELEMENT address (address:company, address:street, address:town, address:region, address:postcode) > <!ATTLIST address id ID #IMPLIED > <!ELEMENT address:company %data;> <!ELEMENT address:street %data; > <!ELEMENT address:town %data; > <!ELEMENT address:region %data;> <!ELEMENT address:postcode %data; > <!ELEMENT same-as EMPTY> <!ATTLIST same-as idref IDREF #REQUIRED > "> <!ENTITY % items " <!ELEMENT item (item:identifier, item:name, item:quantity)> <!ELEMENT item:identifier %data; > <!ELEMENT item:name %data; > <!ELEMENT item:quantity %data; >"> |
Application-specific extensions |
|
XML permits entities and attributes that are defined in the external subset to be redefined in the internal subset. This facility allows XML/EDI users to develop locally significant subclasses. It can also be used to create subsets of messages by removing unused fields from the data model. |
For example, the internal subset of a DTD based on the above standardized DTD could contain the following local redefinition for the %items; parameter entity: |
<!ENTITY % items " <!ELEMENT item (item:identifier, item:name, item:quantity)> <!ELEMENT item:identifier (item:database-key?, item:EAN) > <!ELEMENT item:database-key %data; > <!ELEMENT item:EAN %data; > <!ELEMENT item:name %data; > <!ELEMENT item:quantity %data; > "> |
In this case the optional item:database-key field could contain a direct pointer to the database entry from which the EAN and associated product name were obtained. This key could be used by a DataBot to process the item information without having to generate a query based on the EAN normally provided by the identifier field as the basis for a slower-to-process database query. |
Creating message instances |
|
An XML/EDI electronic business message consists of a pointer to the document type definition, any definitions required in the internal subset of the DTD, and entries for each of the fields required for the message. For example, the following document type declaration could be used to extend the external DTD shown in the first of the examples shown above, which is identified by its Internet Unique Resource Locator: |
<!DOCTYPE order SYSTEM "http://www.myco.org/messages/XML/message1.xml" [ <!ENTITY % items " <!ELEMENT item (item:identifier, item:name, item:quantity)> <!ELEMENT item:identifier (item:database-key?, item:EAN) > <!ELEMENT item:database-key %data; > <!ELEMENT item:EAN %data; > <!ELEMENT item:name %data; > <!ELEMENT item:quantity %data;> "> ]> <order> <order-no>123456</order-no> <deliver-to> <address id="SGML154"> <address:company>The SGML Centre</address:company> <address:street>29 Oldbury Orchard</address:street> <address:town>Churchdown</address:town> <address:region>Glos.</address:region> <address:postcode>GL3 2PU</address:postcode> </address></deliver-to> <invoice-to> <same-as idref="SMGL154"/> </invoice-to> <item><item:identifier> <item:database-key>key151235</item:database-key> <item:EAN>15356378797</item:EAN></item:identifier> <item:name>Special Offer 16</item:name> <item:quantity>12</item:quantity></item></order> |
Note that, because of the prioritization SGML gives to local definitions, the definition for the %items; parameter entity provided in the local subset will replace the reference to the external source for the same entity provided as part of the file referenced using the external subset. |
Validating messages |
|
XML/EDI messages can be validated by a validating XML document instance processor (known as an XML parser) to ensure they contain all required elements from the specified data set, and that the fields are in the required sequence. When the document is found to be valid the parser can generate a document tree that conforms to the rules laid down in the Document Object Model (DOM) specification that provides a standardized API between XML parsers and browsers and other forms of program. |
XML elements can be assigned attributes that point to processors that can undertake relevant data validity checks. This can be done either by associating notation processors with an element, or by associating an ECMAScript specification with the element as part of an XSL "action" associated with the specific element types used in specific contexts, or with particular attribute values. |
Where the XML Style Language (XSL) is not being used (e.g. because the browser does not yet support it) the basic XML language allows user-defined notation processors to be used to validate the contents of specific XML elements. This is done by adding definitions of the following form to the external or internal subset of the DTD: |
<!NOTATION EAN-vailidator SYSTEM "http://www.myco.org/messages/validate/EAN.cgi"> ... <!ATTLIST EAN check NOTATION (EAN-validator) #FIXED "EAN- validator"> |
The predefined check attribute of the EAN element will cause the contents of the element to be passed to the program identified by the declaration for the notation assigned the local name EAN-validator which is stored at the location indicated by the URL given in the notation declaration. This processor would typically pass back a message indicating whether or not the EAN is valid within the context of the relevant message. |
XSL provides an alternative, and more generally applicable method that allows ECMAScript to be used to validate the contents of XML elements. Details of this method are given below under the heading "Processing messages". |
Note:
|
Exchanging messages |
|
Data captured in XML/EDI messages can be exchanged: |
Where conversion into a known EDIFACT format is required the DTD can be extended to provide additional attributes that can guide the transformation process. For example, the following additional properties could be added to the list of attributes assigned to the EAN element: |
<!ATTLIST EAN check NOTATION (EAN-validator) #FIXED "EAN-validator" EDI-prefix CDATA #FIXED "LIN+1++" EDI-suffix CDATA #FIXED ":EN'" > |
Messages exchanged as XML/EDI files can be re-validated on receipt by running them through an XML/EDI validating parser. Where messages have been converted into non-XML files prior to transmission the conversion should be reversed to allow re-validation of the received message. |
During re-validation any linked parts of messages should be retrieved to ensure that the full contents of the message have been checked. When re-validation has been confirmed the Document Object Model created as part of the validation process can be used to create an auditable copy of the received message in a message store/database. |
Processing messages |
|
The way in which a received message would be processed would depend on which of the available methods for exchanging messages was chosen. If the message was received in a format that provided the XML/EDI message generated by the originator, the XML Style Language (XSL) can be used to associate different processes with individual element classes so that elements can be processed by one or more local processors. |
XML/EDI message instances are specifically designed to make the selection of data fields and classes at the receiver as easy as possible. Each field starts with a "start-tag" that clearly identifies the class (element type in SGML/XML parlance) of the following data or embedded subelement set, and specifies any non-default properties to be associated with the data. The end of each data element is clearly identified by an "end-tag", which consists of the name of the element (class) preceded by a slash between a matched pair of outward pointing angle brackets. Fields that contain no data, and no embedded subelements, (e.g. fields that are only present to point to other data sources) have the slash indicating their end point immediately before the last angle bracket of the start-tag rather than immediately after the first one of the end-tag. (See the example for the <same-as/> element above.) Classes that contain subclasses of information have embedded elements between their start-tag and end-tag. |
XSL allows sets of actions to be associated with particular XML elements. Actions can be defined in terms of values to be assigned to a set of data presentation attributes ( styles ), or in terms of a data processing script that users can define using a define-script object . XSL scripts are defined using the ECMAScript language used for exchanging Java programming modules. |
Which actions are associated with which elements can be defined using XML element sets known as XSL rules . A simplified set of style-rules allow presentation properties to be applied to element classes. Rules can be associated with elements that have been assigned a unique identifier ( id ) attribute or that have been assigned a particular value for a class attribute. |
Sets of rules and actions can be defined in macros . Macros can be associated with style processing attributes associated with specific instances of an element. The default set of style properties defined in XSL can be extended using define-style objects |
The component parts of an XML Style Sheet can be: |
A typical XML/EDI XSL description will contain: |
XSL actions are typically associated with the way in which objects should be presented to users. This process is typically controlled through the use of flow objects . XSL provides two default sets of flow objects, one based on the elements typically found in HTML files, and the other based on the flow objects defined in ISO/IEC 10179 (DSSSL). The set of DSSSL flow objects supported by XSL includes: |
The <eval> element can be used to indicate points at which macros and scripts are to be evaluated as a result of applying a rule. |
For an example of the use of XSL specifications based on the use of HTML flow objects refer to Appendix A. |
Activating rules |
|
The XML link process can be used to associate XML/EDI rules with a file. Normally the Simple Link format will be used to identify one or more files containing the relevant rules. Typically this will result in a processing instruction of the following form being added to the start of the document instance: |
<?xml-edi-rules-template HREF="http://www.myco.org/XML/EDI/Rules/orders.xml"?> |
Appendix A1: Using XML/EDI for Book Ordering |
|
The following statement of the current role of EDI in Book Ordering was made by the European Board of EDI Standardization by the UK Book Industry Communication (BIC) manager, Brian Green in May 1997: |
"The nature of the book trade has encouraged its adoption of various forms of Electronic Commerce over the last 20 years. The introduction of a national UK standard book numbering system in the 1960's and an international standard (ISBN) in the early 70's together with central catalogues of books in print in nearly all countries was essential for an industry where even the smallest retail outlet offered customers the facility to order any one of around 600,000 books currently in print (in the UK) from 20,000 publishers with, currently, one hundred thousand new titles appearing every year. There was no hub in the traditional sense since, although WH Smith in the UK has always had a large market share, the number of book titles stocked is relatively low and they have not, until very recently, been much concerned with customers special orders. |
In the late 1970's, the UK book trade set up Teleordering as a centralized ordering service using a simple non-standard order format, providing dedicated terminals on which booksellers simply keyed quantity and ISBN (their location number was installed on the form as a default). The orders were polled overnight by Teleordering and automatically routed to the correct publisher either electronically or, in the case of small publishers, by mail or fax. The bookseller received a basic confirmation of receipt of the order by Teleordering with an indication from the Teleordering database whether the book was recorded as available or out of print. Today TeleOrdering has an annual throughput of some 27 million orders, runs on PC's and is owned J Whitaker & Sons who also publish a 'books in print' CD-ROM and provide a sales data monitoring service. Teleordering has also established itself as an EDI VAN with a full range of Tradacoms and EDIFACT messages. The two services run side by side and will convert the non-standard Teleordering format orders coming from booksellers to EDIFACT or Tradacoms for transmission to publishers. |
Similar services were set up in other European countries, the US, Canada etc., although the UK service has always been the largest in the world. |
A second book trade EDI service, called First EDItion was set up in 1992 in the UK. This is a pure EDI service based on INS and is particularly strong in the library sector. Both First EDItion and Teleordering are being used for international trade, mainly between UK publishers and European wholesalers who, e.g. in Netherlands and Germany, operate their own dedicated electronic ordering services for booksellers in their countries. First Edition has announced that it will introduce a book trade service based on GE's "TradeWeb", which offers a forms-based Internet service linking to the GEIS VAN. |
There has been an interesting 'light EDI' scheme running in the UK for the last four years. Following publication of the book trade Tradacoms messages by Book Industry Communication, the UK book trade EDI body, the major UK wholesalers, who had until then been offering dedicated electronic ordering services, decided to collaborate in a service called BUYLINE. They provided all their bookseller customers, at a nominal cost with simple forms based ordering software that links in with either the 'book bank' books in print CD-ROM or a wholesalers own stockist, enabling the bookseller to select the books required and choose their supplier from a pull down list. BUYLINE includes communications software that dials up the selected supplier and transmits the order in Tradacoms format. The software will also accept Tradacoms acknowledgments and present these to the user in a simple user-friendly format. The rights in this product have now reverted to the systems house, Triptych! ! ! , who developed it and they are extending the service to the major distributors as well as wholesalers. Their software is also included in a number of the book shop computer systems. It is generally expected that the BUYLINE system will migrate to EDIFACT and use Internet rather than direct dial up communications in due course. |
A further development is the regular monthly production of multimedia CD-ROM stock catalogues by major European wholesalers. Most of these allow users to build order files and output them in EDI formats, normally using direct dial-up. It is anticipated that data compression and increased bandwidth will soon allow these facilities to be available over Internet. An important point, however, is that BIC in the UK and EDItEUR in Europe have managed to produce a consensus on the book trade implementation of the messages that ensures that all recent services use standard message formats." |
BIC feel that trials of standard forms freely available over the Internet, outputting EDIFACT messages to any trading partner able to receive them, would be very helpful. |
Applying XML/EDI to Book Ordering |
|
The form shown in has been designed for displaying a book order based on the <A HREF="http://www.editeur.org/">EDItEUR</A>
Book Ordering Message as described in the EDItEUR EDI Implementation Guidelines for Book Trade Distribution.
|
Note:
|
A.1 Form for displaying EDItEUR Lite-EDI Book Order Messages |
![]() |
shows how XML is used to code the form in if all of the data was being supplied as part of the received message. |
A.2 XML encoding of Book Order Message |
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <?xml-stylesheet href="edi-lite.xsl" type="text/xsl"> <!DOCTYPE Book-Order SYSTEM "edi-lite.dtd"> <Book-Order Supplier="4012345000951" Send -to="mailto:orders@sgml.u-net.com"> <Title>EDItEUR Lite-EDI Book Ordering</Title> <Order-No>967634</Order-No> <Message-Date>19990308</Message-Date> <Buyer-EAN>5412345000176</Buyer-EAN> <Order-Line Reference-No="0528835"> <ISBN>0201403943</ISBN> <Author-Title>Bryan, Martin/SGML and HTML Explained</Author-Title> <Quantity>1</Quantity> </Order-Line> <Order-Line Reference-No="0528836"> <ISBN>0856674427</ISBN> <Author-Title>Light, Richard/Presenting XML</Author-Title> <Quantity>1</Quantity> </Order-Line> </Book-Order> |
A typical reaction to comparing this file with the displayed example and its EDI-based EDItEUR equivaent is "Where has all the EDI information gone?", and "Where has all the material under the table come from?". The answer is that all immutable information goes into the document type definition (DTD) referenced in the <!DOCTYPE statement that starts the coding, or in the associated style sheet. |
Note:
|
shows the contents of the DTD used for this example. The single line reference to this DTD is sufficient to provide the browser with all the additional information it needs to process the message. |
Note how the definition of each element defined in contains attributes whose fixed values contain the prefixes and suffixes of each of the EDIFACT fields that may need to be generated in response to the messages. |
The message format generated from the completed form could be a pure EDIFACT message of the type shown on Page II-2-2 of the EDItEUR EDI Implementation Guidelines for Book Trade Distribution. |
Note:
|
A.3 XML Document Type Definition for Lite-EDI Book Order |
<!DOCTYPE Book-Order [ <!--XML-conformant Document Type Defintion for EDItEUR Book Order Message. Version 1.1 - Created January 1998 by M. Bryan from The SGML Centre This DTD should be referenced using the following public identifier: PUBLIC "-//EDItEUR//DTD Book Order Message//EN" --> <!--Entities referenced within DTD--> <!--Entities used to datatype attribute values--> <!--Uniform Resource Locator identifier. Contents of attribute must provide a valid HTTP or MAILTO address conforming to IETF RFC 822--> <!ENTITY % URL "CDATA" > <!--EAN location code. Number that uniquely identifies suppliers/purchasers. --> <!ENTITY % EAN "NUMBER"> <!--Formal EDIFACT definition of datatype. May be used by EDI-compliant browsers to validate the data entered by users prior to acceptance when a user attempts to move to another field. --> <!ENTITY % EDItype "NAME" > <!--Message Content element declarations--> <!--Book Order element: Purpose: Container for message fields and support information. Attributes: EDI-Prefix formally identifies type of message. EDI-Suffix contains strings to be output at end of message. Send-to identifies Uniform Reference Locator (URL) for site to which EDIFACT message is to be sent for processing. Supplier contains unique EAN that identifies supplier. --> <!ELEMENT Book-Order (Title?, Order-No, Message-Date, Buyer-EAN, Order-Line+)> <!ATTLIST Book-Order EDI-Prefix CDATA #FIXED "UNH+ME00579+ORDERS:D:93A:UN:EAN007" EDI-Suffix CDATA #FIXED "UNS+S'CNT+2:2'UNT+18+ME00579" Send-to %URL; #REQUIRED Supplier %EAN; #REQUIRED > <!--Title element: Purpose: Used to provide supplier dependent title for form: Title can be displayed in window header or at top of form, or in both locations --> <!ELEMENT Title (#PCDATA) > <!--Order Number element: Purpose: Allows users to assign unique number to their order. Attributes: EDI-Prefix formally identifies type of message. Datatype identifies format that contents must conform to. Size indicates width of box to be used to capture input. Title indicates text to precede box. --> <!ELEMENT Order-No (#PCDATA) > <!ATTLIST Order-No EDI-Prefix CDATA #FIXED "BGM+220+" Datatype %EDItype; #FIXED "C8" Size NUMBER #FIXED "8" Title CDATA "Book Order No:" > <!--Message Date element: Purpose: To indicate date order was placed. Date must be entered in ISO 8601 format without separators, e.g. CCYYMMDD Attributes: EDI-Prefix formally identifies type of message. EDI-Suffix identifies data to immediately follow contents. Datatype identifies format that contents must conform to. Size indicates width of box to be used to capture input. Title indicates text to precede input field. Comment contains explanatory text to follow the input field. --> <!ELEMENT Message-Date (#PCDATA) > <!ATTLIST Message-Date EDI-Prefix CDATA #FIXED "DTM+137+" EDI-Suffix CDATA #FIXED ":102" Datatype %EDItype; #FIXED "Date" Size NUMBER #FIXED "12" Title CDATA "Message Date:" Comment CDATA "Enter dates in CCYYMMDD format" > <!--Buyer EAN identifier element: Purpose: To identify the unique EAN assigned to the purchaser. Attributes: EDI-Prefix formally identifies type of message. EDI-Suffix identifies data to immediately follow contents. Datatype identifies format that contents must conform to. Size indicates width of box to be used to capture input. Title indicates text to precede box. --> <!ELEMENT Buyer-EAN (#PCDATA) > <!ATTLIST Buyer-EAN EDI-Prefix CDATA #FIXED "NAD+BY+" EDI-Suffix CDATA #FIXED "::9" Datatype %EDItype; #FIXED "C13" Size NUMBER #FIXED "13" Title CDATA "Buyer EAN:" > <!--Order line element: Purpose: Container for objects used to order book. Attributes: EDI-Prefix formally identifies type of message. Line-no is calculated by system to be 1 + number of preceding order lines within file. Ref-Prefix identifies EDI prefix for reference number Reference-no uniquely identifies each line. Number is supplied by supplier's system with input file. --> <!ELEMENT Order-Line (ISBN, Author-Title, Quantity) > <!ATTLIST Order-Line EDI-Prefix CDATA #FIXED "LIN+" Line-no NUMBER #IMPLIED Ref-Prefix CDATA #FIXED "#RFF+LI:" Reference-No NUMBER #REQUIRED > <!--ISBN element: Purpose: To enter unique ISBN of book to be ordered Attributes: EDI-Prefix formally identifies type of message. EDI-Suffix identifies data to immediately follow contents. Datatype identifies format that contents must conform to. Size indicates width of box to be used to capture input. Title indicates text to precede box. --> <!ELEMENT ISBN (#PCDATA) > <!ATTLIST ISBN EDI-Prefix CDATA #FIXED "PIA+5+" EDI-Suffix CDATA #FIXED ":IB" Datatype %EDItype; #FIXED "N12" Size NUMBER #FIXED "12" Title CDATA "ISBN:" > <!--Author and Title element: Purpose: Optional statement of author and title details to confirm correct ISBN has been entered. Attributes: EDI-Prefix formally identifies type of message. Datatype identifies format that contents must conform to. Size indicates width of box to be used to capture input. Title indicates text to precede box. --> <!ELEMENT Author-Title (#PCDATA) > <!ATTLIST Author-Title EDI-Prefix CDATA #FIXED "IMD+F+BST+:::" Datatype %EDItype; #FIXED "C60" Size NUMBER #FIXED "40" Title CDATA "Author/Title:" > <!--Quantity element: Purpose: To identify the number of copies required. Attributes: EDI-Prefix formally identifies type of message. Datatype identifies format that contents must conform to. Size indicates width of box to be used to capture input. Title indicates text to precede box. --> <!ELEMENT Quantity (#PCDATA) > <!ATTLIST Quantity EDI-Prefix CDATA #FIXED "PQTY+21:" Datatype %EDItype; #FIXED "N2" Size NUMBER #FIXED "2" Title CDATA "Quantity:" > <!--Declarations for message control support elements--> <!--Electronic Address element: Purpose: To capture electronic address to which messages from the supplier to the buyer can be sent. --> <!ENTITY % ISOlat1 SYSTEM "A:\\ISOlat1.ent" > <!ENTITY % ISOnum SYSTEM "a:\\ISOnum.ent" > %ISOlat1; %ISOnum; ]> |
The XSL style sheet used to create the displayed version of the form shown in took the form shown in : |
A.4 XSL Processing Rules for Example Lite-EDI Book Order |
<xsl> <define-script> <![CDATA[ function ISO8601DateCheck(date) { year = date.substring(0,4); /* For some reason you need to point to one character beyond the end of the required substring (despite what it says in the Microsoft Reference Manual) */ month = date.substring(4,6); month--; /* Microsoft have a bug in their toUTCString convertor of month names! */ day = date.substring(6,8); MessageDate = new Date(year, month, day); return(MessageDate.toUTCString().substring(0,16)); /* Microsoft do not support toGMTString, and to LocaleString does not pick up the default date format set for Windows 95 regional settings. */ } ]]></define-script> <rule> <root/> <HTML><TITLE>EDItEUR Book Order</TITLE> <BODY> <FORM METHOD="POST" ACTION="=getAttribute('Send-to')"> <H2 ALIGN="CENTER"> <select-elements> <target-element type="title"/> </select-elements> </H2> <TABLE BORDER="" cellpadding="4" cellspacing="0" bordercolor="#FF0000"> <TBODY><select-elements> <target-element type="Order-No"/> </select-elements><select-elements> <target-element type="Message-Date"/> </select-elements><select-elements> <target-element type="Buyer-EAN"/> </select-elements><select-elements> <target-element type="Order-Line"/> </select-elements></TBODY> </TABLE> <DIV style="font: 10pt Arial"> <BR/> <input type="checkbox" name="partial" value="allowed"/> Tick here if a delayed/partial supply of order is acceptable <BR/> <input type="checkbox" name="confirmation" value="requested"/> Tick here if Confirmation of Acceptance of Order is to be returned by e-mail <BR/> <input type="checkbox" name="DeliveryNote" value="required"/> Tick here if e-mail Delivery Note is required to confirm details of delivery <BR/><BR/> E-mail address: <input type="text" name="e-address" size="30"/> <BR/><BR/> Please respond in: <select name="response-language"> <option value="EN" selected="selected">English</option> <option value="FR">Français</option> <option value="DE">Deutsch</option> <option value="ES">Espagnol</option> <option value="IT">Italiano</option></select> <BR/><BR/> <input type="submit" value="Press here to send completed form to supplier"/> </DIV> </FORM> </BODY></HTML> </rule> <rule> <target-element type="Order-No"/> <TR> <TD style="font: 12pt Times">Book Order No:</TD> <TD><INPUT NAME="Order-No" VALUE="=this.text"/></TD> <TD>Your reference number for order</TD> </TR> </rule> <rule> <target-element type="Message-Date"/> <TR> <TD style="font: 12pt Times">Message Date:</TD> <TD><INPUT NAME="DATE" VALUE="=this.text" SIZE="8"/> (<eval>ISO8601DateCheck(this.text)</eval>)</TD> <TD>Date in CCYYMMDD format</TD> </TR> </rule> <rule> <target-element type="Buyer-EAN"/> <TR> <TD style="font: 12pt Times">Buyer EAN:</TD> <TD><INPUT NAME="Buyer" VALUE="=this.text" SIZE="13"/></TD> <TD>Your unique identification number</TD> </TR> <TR> <TD style="font: 12pt Times">Supplier EAN:</TD> <TD style="font: 10pt Arial"> <eval>ancestor("Book-Order", this).getAttribute("Supplier")</eval></TD> <TD ALIGN="center"><strong>Book Supplies Incorporated</strong></TD> </TR> </rule> <rule> <element type="Order-Line"> <target-element type="ISBN"/> </element> <TR> <TD style="font: 12pt Times">ISBN:</TD> <TD><INPUT NAME="='ISBN-' + ancestor('Order-Line', this).getAttribute('Reference-No')" VALUE="=this.text" SIZE="10"/></TD> <TD ALIGN="CENTER" rowspan="3"> Order line reference number:<BR/> <SPAN style="font: 10pt Arial;"> <eval> String(Number(ancestor("Order-Line",this).getAttribute("Reference-No"))) </eval> </SPAN> </TD> </TR> </rule> <rule> <element type="Order-Line"> <target-element type="Author-Title"/> </element> <TR> <TD style="font: 12pt Times">Author/Title:</TD> <TD><INPUT NAME="='Title-' + ancestor('Order-Line', this).getAttribute('Reference-No')" VALUE="=this.text" size="35"/></TD> </TR> </rule> <rule> <element type="Order-Line"> <target-element type="Quantity"/> </element> <TR> <TD style="font: 12pt Times">Quantity:</TD> <TD><INPUT NAME="='Quantity-' + ancestor('Order-Line', this).getAttribute('Reference-No')" VALUE="=this.text" SIZE="4"/></TD> </TR> </rule> </xsl> |
The style sheet is itself coded in XML, conforming to an unidentified meta-DTD specified by the XSL protocol. The first element within this document shows how developers can define functions using the ECMAScript language embedded within XSL. This example converts ISO 8601 format dates to a form that is easier for users to check. This is a simple example of the powerful client-side functionality that can be added to XSL style-sheets. |
Note:
|
The remainder of the style sheet consists of a set of <rule> elements that identify a sequence of actions associated with target elements . The actions create HTML flow objects that Internet Explorer 4.0 displays. |
Note:
|
Other significant features that should be noted from this example include: |
|
Users of Version 4.0 of Microsoft's Internet Exlplorer web browser will find a demonstration of the application of the above simple examples at <A HREF="http://www.xmledi.net/edi-test.htm">http://www.xmledi.net/edi-test.htm</A>
|
Glossary |
|
DataBots - XML/EDI Data Manipulation Agent (a.k.a. "Bot" is a software term for a component that acts as an Agent). |
XML/EDI-R - the combination of XML message syntax and rule based EDI. |
Bibliography |
|
Bons, R (1997) Designing Trustworthy Trade Procedures for EC . |
To be developed |
| Style Concepts | Table of contents | Indexes | Implementing a Link Editor | |||