Informatica B2B 数据转换

发布于 2024-12-11 04:03:18 字数 2696 浏览 2 评论 0原文

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

xsd 示例

那就是我有一个

在此处输入图像描述

我只想获取“一”部分

我只想提取“一”元素而不关心它来自哪个底层类型,即我想将结果放入下面的“one”中,无论它来自 thingyone、thingytwo 还是 thingythird。

在此处输入图像描述

在 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>

I am trying to handle a xsd:choice in the B2B transformation engine.

(xsd examples here)

That is I have a

enter image description here

And I am only intrested in getting the "one" part

And I only want extract the "one" element not caring from which underlying type it comes from, i.e. I want to put the result into "one" below regardless if it comes from the thingyone, thingytwo or thingythree.

enter image description here

In XSLT terms I would like to do:

<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>

Transformed by

<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>

Would become

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文