Informatica B2B数据转换

时间:2011-10-19 20:13:00

标签: informatica-powercenter informatica

我正在尝试在B2B转换引擎中处理xsd:choice。

xsd examples here

那就是我有一个

enter image description here

我只对获得“一个”部分感兴趣

而且我只想提取“一个”元素,而不是从它来自哪个基础类型,即我想把结果放到下面的“一”,不管它是来自thingyone,thingytwo还是thingythree。

enter image description here

在XSLT术语中,我想这样做:

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.differentthingies.com/20111119/thingy" xsi:schemaLocation="http://xmlns.differentthingies.com/20111119/thingy differentthinggies.xsd">
    <differentthingies>
        <thingythree>
            <one>thisisthingythree1</one>
            <three2>thisisthingythree2</three2>
            <three3>thisisthingythree3</three3>
        </thingythree>
    </differentthingies>
</root>

转换
<xsl:template match="/">
        <xsl:variable name="var1_root" select="ns0:root"/>
        <root xmlns="http://xmlns.differentthingies.com/20111119/anotherthingy">
            <xsl:attribute name="xsi:schemaLocation" namespace="http://www.w3.org/2001/XMLSchema-instance">http://xmlns.differentthingies.com/20111119/anotherthingy thingy.xsd</xsl:attribute>
            <thingyone>
                <xsl:for-each select="$var1_root/ns0:differentthingies/ns0:thingyone/ns0:one">
                    <one>
                        <xsl:value-of select="string(.)"/>
                    </one>
                </xsl:for-each>
                <xsl:for-each select="$var1_root/ns0:differentthingies/ns0:thingythree/ns0:one">
                    <one>
                        <xsl:value-of select="string(.)"/>
                    </one>
                </xsl:for-each>
                <xsl:for-each select="$var1_root/ns0:differentthingies/ns0:thingytwo/ns0:one">
                    <one>
                        <xsl:value-of select="string(.)"/>
                    </one>
                </xsl:for-each>
            </thingyone>
        </root>
    </xsl:template>

会变成

<root xmlns="http://xmlns.differentthingies.com/20111119/anotherthingy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.differentthingies.com/20111119/anotherthingy thingy.xsd">
    <thingyone>
        <one>thisisthingythree1</one>
    </thingyone>
</root>

0 个答案:

没有答案