First - thanks to everybody for the fast answers and for the hints so
far (even that I didn't get Dimitres example to run - using Stylus
Studio with MSXML/MSXML 4.0). This seems to me a great and helpful
mailing list.
Second - The XPaths of the XML schema documents are used to create
mappings between EDI field descriptions and the XML file in which they
should be transferred. The XML schemas are the base for the mapping
design. First intention is, to control if every given XPath in the
mapping documents (usually Excel sheets) is correct written. Next
intention is, to get an easy diff about the ongoing changes in the XML
schema documents. So hierarchy doesn't matter. It's only important that
the list contains every used unique XPath to an named element.
Namespaces are not used. Indeed the XML schemata are very simple and
don't use much of the possibilities that an XML schema offers. But at
least they group elements to complex elements and use references. There
is no elaborated software intended, which will use this information.
Below is a concrete example of such a schema
The desired XSLT would produce a list like
/OBBISOFT/MESSAGE/MESSAGE_NO
/OBBISOFT/MESSAGE/MESSAGE_VERSION_NO
/OBBISOFT/MESSAGE/MESSAGE_SENDER/MAIN
/OBBISOFT/MESSAGE/MESSAGE_SENDER/CENTER
/OBBISOFT/MESSAGE/MESSAGE_SENDER/TEAM
...
which lists only the elements.
A list like
/OBBISOFT
/OBBISOFT/MESSAGE
/OBBISOFT/MESSAGE/MESSAGE_NO
wouldn't be the desired output.
<?xml version="1.0" encoding="UTF-8"?>
<!--***************************************************-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<!--***************************************************-->
<!--** SIMPLE TYPES-->
<!--***************************************************-->
<xs:simpleType name="NotEmptyString">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="DurationType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BooleanType">
<xs:restriction base="xs:string">
<xs:enumeration value="TRUE"/>
<xs:enumeration value="FALSE"/>
</xs:restriction>
</xs:simpleType>
<!--***************************************************-->
<!--** ELEMENTS-->
<!--***************************************************-->
<!--ROLEType-->
<!--NotEmptyString-->
<xs:element name="CENTER" type="NotEmptyString"/>
<xs:element name="CTO_NO" type="NotEmptyString"/>
<xs:element name="ERROR_ID" type="NotEmptyString">
<xs:annotation>
<xs:documentation>Type of error</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ERROR_KIND" type="NotEmptyString">
<xs:annotation>
<xs:documentation>Describes the nature of the error
See list of domain values</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ERROR_MEANING" type="NotEmptyString"/>
<xs:element name="EXT_SYSTEM" type="NotEmptyString">
<xs:annotation>
<xs:documentation>For external message consignee or
dedicated system name</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="MAIN" type="NotEmptyString"/>
<xs:element name="MESSAGE_NO" type="NotEmptyString">
<xs:annotation>
<xs:documentation>Running counter of the message for unique
identification</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="REFERENCE" type="NotEmptyString"/>
<xs:element name="TEAM" type="NotEmptyString"/>
<xs:element name="TOURNEE" type="NotEmptyString"/>
<!--***************************************************-->
<!--long-->
<!--***************************************************-->
<!--int-->
<xs:element name="MESSAGE_VERSION_NO">
<xs:annotation>
<xs:documentation>Design version of the
message</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="999"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<!--***************************************************-->
<!--decimal-->
<!--***************************************************-->
<!--date-->
<!--***************************************************-->
<!--duration-->
<!--***************************************************-->
<!--boolean-->
<xs:element name="TRUCK_NO" type="NotEmptyString"/>
<xs:element name="OBBISOFT">
<xs:complexType>
<xs:sequence>
<xs:element name="MESSAGE">
<xs:complexType>
<xs:sequence>
<xs:element ref="MESSAGE_NO"/>
<xs:element ref="MESSAGE_VERSION_NO"/>
<xs:element name="MSG_SENDER">
<xs:annotation>
<xs:documentation>Organisational
unit sending the message</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice>
<xs:annotation>
<xs:documentation>1 or
Both</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:element name="ORGANIZATION">
<xs:annotation>
<xs:documentation>For DHL internal message consignee</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element
ref="MAIN"/>
<xs:element
ref="CENTER"/>
<xs:element
ref="TEAM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="EXT_SYSTEM"/>
</xs:choice>
<xs:sequence>
<xs:annotation>
<xs:documentation/>
</xs:annotation>
<xs:element name="ORGANIZATION">
<xs:annotation>
<xs:documentation>For DHL internal message consignee</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element
ref="MAIN"/>
<xs:element
ref="CENTER"/>
<xs:element
ref="TEAM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="EXT_SYSTEM"/>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="MSG_CONSIGNEE">
<xs:annotation>
<xs:documentation>Organisational
unit receiving the message</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice>
<xs:annotation>
<xs:documentation>1 or
Both</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:element name="ORGANIZATION">
<xs:annotation>
<xs:documentation>For DHL internal message consignee</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element
ref="MAIN"/>
<xs:element
ref="CENTER"/>
<xs:element
ref="TEAM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="EXT_SYSTEM"/>
</xs:choice>
<xs:sequence>
<xs:element name="ORGANIZATION">
<xs:annotation>
<xs:documentation>For DHL internal message consignee</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element
ref="MAIN"/>
<xs:element
ref="CENTER"/>
<xs:element
ref="TEAM"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="EXT_SYSTEM"/>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="MSG_ERROR" minOccurs="0"
maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Contains the error
messages generated by the MessageManager module during
integration/extraction</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="ERROR_ID"/>
<xs:element ref="ERROR_MEANING"/>
<xs:element ref="REFERENCE"
minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:choice>
<xs:element name="STANDARD_MESSAGE">
<xs:annotation>
<xs:documentation>NPS
messages</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice>
<xs:choice>
<xs:annotation>
<xs:documentation>NPS Messages</xs:documentation>
</xs:annotation>
<xs:element name="DC_INPUT">
<xs:annotation>
<xs:documentation>Input from the Swedish Tour Optimisation Software
Please note: The MAIN is specified in ../MSG_CONSIGNEE/MAIN
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element
name="DC_INPUTS" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:documentation>CTO_NO
Contains the DHL identification number of the (delivery-) operation that
has been optimised.
SUBBAY_ID is a dedicated area inside a terminal where the goods for the
above operation will be stored
TOURNEE contains the standard round trip to be used to execute the operation
TRUCK_NO =
registration plate number of the truck performing the round trip
</xs:documentation>
</xs:annotation>
<xs:element ref="CTO_NO"/>
<xs:element name="SUBBAY_ID" type="NotEmptyString"/>
<xs:element ref="TOURNEE" minOccurs="0"/>
<xs:element ref="TRUCK_NO" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
--
Kind regards
Michael Lindenau
Lvsungen+Ideen
"Any problem in computer science can be solved with
another layer of indirection. But that usually will
create another problem!" <David Wheeler>
mobile: +49 (0) 179 29 28 834
e-mail: michael.lindenau@xxxxxxxxxxxxxxxxxxxxxx
-------------------------------------------------------
Lvsungen+Ideen
Alejandro Puskin No 1, Portal H, 5C
29011 Malaga
ES - Espaqa
-------------------------------------------------------
This email is confidential. If you are not the intended
recipient, you must not disclose or use the information
contained in it. If you have received this mail in error,
please tell me immediately by return email and delete
the document.