Hi Buddy,
I have a requirement to convert the below shown input.xml into result.xml and the XSLT which I am trying with is shown at the end.
input.xml:
<match>
<FieldMatcherResult>
<FieldPair>
<Context>A</Context>
<Field1>A1</Field1>
<Field2>A2</Field2>
</FieldPair>
<FieldPair>
<Context>B</Context>
<Field1>B1</Field1>
<Field2>B2</Field2>
</FieldPair>
</FieldMatcherResult>
</match>
result.xml:
<result>
<FieldMatcherResult>
<FieldPair>
<Context>A</Context>
<Field1>A1</Field1>
<Field2>A2</Field2>
</FieldPair>
</FieldMatcherResult>
<FieldMatcherResult>
<FieldPair>
<Context>B</Context>
<Field1>B1</Field1>
<Field2>B2</Field2>
</FieldPair>
</FieldMatcherResult>
<FieldMatcherResult>
</result>
I have written transformation like:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="FieldMatcherResult">
<result>
<xsl:for-each select="FieldPair">
<FieldMatcherResult>
<xsl:copy-of select="." />
</FieldMatcherResult>
</xsl:for-each>
</result>
</xsl:template>
</xsl:stylesheet>
But it's not working............simply throwing java.util.EmptyStackException(I am using the XSLT inside a java based application).....Can anybody help me where I am doing wrong in the transformation......
Any help would be greatly appreciated......
Thank you...!!!