문제

Is there a way of achieve the following transformation in the BT mapper? if not, any smart idea?

<Person>
<Age>25</Age>
<Name>Paul</Name>
</Person>

to:

<Person>
<CustomProperties>
<CustomProperty>
<Name>Age</Name>
<Value>25</VAlue>
</CustomProperty>
<CustomProperty>
<Name>Name</Name>
<Value>Paul</VAlue>
</CustomProperty>
</CustomProperties>

I have to aggregate a few elements in a list of nodes.

Thanks in advance.

도움이 되었습니까?

해결책

Don't know much about the BizTalk mapper, but the required XSLT would be fairly straight-forward:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="Person">
    <xsl:copy>
      <CustomProperties>
        <xsl:apply-templates select="*" />
      </CustomProperties>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="Person/*">
    <CustomProperty>
      <Name><xsl:value-of select="name()" /></Name>
      <Value><xsl:value-of select="." /></Value>
    </CustomProperty>
  </xsl:template>
</xsl:stylesheet>

다른 팁

You can also use the TableLooping / TableExtractor functoids in your map to build the destination nodes.

See this post for an example:

http://hestia.typepad.com/flatlander/2007/01/mapping_fixed_e.html

It looks like you have a straight forward mapping from input to output. When you do your mapping right click on the line drawn from the input to the output. Select "Properties". There are options to either copy the value of the input node or the name of the input node. You can use two mappings from each child node, one to extract the name and one for the value.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top