Question

I have a source schema in which the address may be given either as multiple "AddressLine" elements or as multiple "Street" elements, or a combination. My destination schema simply has multiple "Street" elements. I'm having trouble mapping this with functoids (it's no problem with custom XSLT but I'd rather use the graphical method for this map). I've tried mapping both source elements to a looping functoid and then out of this into the destination element but this just produces XSLT that loops through the source "AddressLine" and "Street" elements but doesn't write anything to the destination!

I've pasted the relevant sections of the source and destination schemas below:

Source

<xsd:complexType name="Address">
    <xsd:sequence>
        <xsd:element name="AddressLine" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
            <xsd:annotation>
                <xsd:documentation>Free format address lines may be used instead of (or in addition to) specific Street etc elements.</xsd:documentation>
            </xsd:annotation>
        </xsd:element>
        <xsd:element name="Street" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element name="City" type="xsd:string" minOccurs="0"/>
        <xsd:element name="State" type="xsd:string" minOccurs="0">
            <xsd:annotation>
                <xsd:documentation>State/County/Province</xsd:documentation>
            </xsd:annotation>
        </xsd:element>
        <xsd:element name="PostCode" type="xsd:string" minOccurs="0">
            <xsd:annotation>
                <xsd:documentation>Post/ZIP code</xsd:documentation>
            </xsd:annotation>
        </xsd:element>
        <xsd:element name="Country" minOccurs="0">
            <xsd:complexType>
                <xsd:simpleContent>
                    <xsd:extension base="xsd:string">
                        <xsd:attribute name="Code" type="xsd:string" use="optional"/>
                        <xsd:attribute name="Codelist" type="xsd:string" use="optional"/>
                    </xsd:extension>
                </xsd:simpleContent>
            </xsd:complexType>
        </xsd:element>
    </xsd:sequence>
</xsd:complexType>

Destination

<xs:element name="Address" minOccurs="0">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="Street" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                                    <xs:element name="City" type="xs:string" minOccurs="0"/>
                                    <xs:element name="State" type="xs:string" minOccurs="0">
                                        <xs:annotation>
                                            <xs:documentation>State/County/Province</xs:documentation>
                                        </xs:annotation>
                                    </xs:element>
                                    <xs:element name="PostCode" type="xs:string" minOccurs="0">
                                        <xs:annotation>
                                            <xs:documentation>Post/ZIP code</xs:documentation>
                                        </xs:annotation>
                                    </xs:element>
                                    <xs:element name="Country" minOccurs="0">
                                        <xs:complexType>
                                            <xs:simpleContent>
                                                <xs:extension base="xs:string">
                                                    <xs:attribute name="Code" type="xs:string"/>
                                                </xs:extension>
                                            </xs:simpleContent>
                                        </xs:complexType>
                                    </xs:element>
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
Was it helpful?

Solution

Your links to the looping functoid define the looping structure only. To get the actual data after you define the loop structure, you have to connect the source and destination nodes.

For your example, drop a looping functoid on the design surface. Connect AddressLine and Street from the source to the looping functoid. Then connect the looping functoid to street in the destination. Now, connect both AddressLine and Street in the source directly to Street in the destination.

Hopefully that makes sense.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top