Flatten A Node In XSLT

<xsl:for-each select=MyNode>

  <MyNode>

    <xsl:for-each select=@*|*[not(* or @*)]>

      <xsl:attribute name={name(.)}>

        <xsl:value-of select=./>

      </xsl:attribute>

    </xsl:for-each>

  </MyNode>

</xsl:for-each>

Where MyNode:

<MyNode>value1</MyNode>

<MyNode>value2</MyNode>

<MyNode>value3</MyNode>

Advertisements