my xml is :
<Row>
<one>1</one>
<two>2</two>
</Row>
and My expected result is :
<main>
<value type="one_type">
<stringValue>1</stringValue>
</value>
<value type="two_type">
<stringValue>2</stringValue>
</value>
</main>
and my xsl is :
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="one|two">
<main>
<xsl:choose>
<xsl:when test="one">
<value type="one_type">
<stringValue>
<xsl:apply-templates select="@*|node()"/>
</stringValue>
</value>
</xsl:when>
<xsl:otherwise>
<value type="two_type">
<stringValue>
<xsl:apply-templates select="@*|node()"/>
</stringValue>
</value>
</xsl:otherwise>
</xsl:choose>
</main>
</xsl:template>
But this returns two different main tags and I want all the tags to be under the main tag. Any Idea how to do this ? i thought if else will give me the desired result but it does not.
No comments:
Post a Comment