0

I'm using the DataMapper component in MuleStudio. I want to transform data that I have in this format

<item type="1" name="data">
    <children name="action">
        <values>login.01</values>
    <children>
</item>

to something like this

<item>
    <action>login.01</action>
</item>

Is this possible through Mule? Or will I need to make a custom Java parser?

4

1 に答える 1

2

ソースが XML であると仮定すると、DataMapper を使用する必要はありません。単純な XSL-T トランスフォーマーでうまくいきます。

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

  <xsl:template match="children">
    <xsl:element name="{@name}">
      <xsl:apply-templates select="values/text()" />
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>
于 2013-06-17T21:21:17.507 に答える