B2B 変換エンジンで xsd:choice を処理しようとしています。
( xsd の例はこちら)
つまり、私は
そして、私は「1」の部分を取得することにのみ興味があります
そして、基になる型を気にせずに「1」要素のみを抽出したい。つまり、thingyone、thingytwo、thingythree のいずれからのものかに関係なく、結果を下の「1」に入れたい。
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>