0

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>
Rob Bowman
  • 7,632
  • 22
  • 93
  • 200
  • Would you want to use the scripting functoid with a .NET method or this is basically like using XSLT for you? Personally, I think it would be easier to code in .NET than in XSLT. – Ben Cline Mar 15 '12 at 19:14
  • I agree, it would be easier to revert to code this but I'd like to know if / how this could be done using functoids. – Rob Bowman Mar 19 '12 at 16:05
  • Looked at table looping och table extractor? http://geekswithblogs.net/evankoch/archive/2007/08/07/114470.aspx – Riri Mar 21 '12 at 11:03

1 Answers1

0

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.

Jay
  • 16
  • 1