我有一个源模式,其中地址可以作为多个“AddressLine”元素或多个“Street”元素或组合给出。我的目标架构只有多个“街道”元素。我在用 functoids 映射它时遇到了麻烦(自定义 XSLT 没有问题,但我宁愿使用这个映射的图形方法)。我已经尝试将两个源元素映射到一个循环functoid,然后将其映射到目标元素,但这只会产生循环通过源“AddressLine”和“Street”元素但不向目标写入任何内容的XSLT!
我在下面粘贴了源模式和目标模式的相关部分:
来源
<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>
目的地
<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>