Hi, I have a structured XML file format that needs to be mapped to a flatter XML format. Ordinarily I would create a custom XSLT file for this and have the BizTalk map use it. However, I do like the idea of using the graphical maps where possible - it's all too easy to dive straight into XSLT but not so easy for those following you to quickly understand what the map's doing!
I suspect that the mapping could be acheived using the table looping function and table extractor functoid but I've tried for a couple of hours and failed :(
Note: I have no control over the source XSD - this comes from a third party. Here it is:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="VehicleTrips">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Vehicle">
<xs:complexType>
<xs:sequence>
<xs:element name="VehicleID"/>
<xs:element name="VehicleRegistration"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Trips">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="VehicleId"/>
<xs:element name="Distance"/>
<xs:element name="Duration"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
...and here's the target XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Trips">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="VehicleRegistration"/>
<xs:element name="Distance"/>
<xs:element name="Duration"/>
</xs:sequence>
</xs:complexType>
</xs:element>
To summarise, I need to look into Trips, grab the VehicleRegistration from Vehicle, keyed on VehicleId and copy the data across to the target schema.
Does anyone know whether / how this could be achieved using only functoids (or perhaps a little script in a scripting functoid)?
Many thanks, Rob.