Informatica B2B 数据转换
我正在尝试处理 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.
That is I have a
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.
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论