I have an xml file generated using xslt script which I am trying to upload to a UI but when I try to do so I get the below exception for one of the tags, org.xml.sax.SAXParseException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'Apples'. No child element is expected at this point
Below is the block from xsl script that's creating trouble,
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:ns2="http://www.google.com/fruits" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ns2:FruitCatalog>
<xsl:variable name="schemaVersion" select="'26.0'"/>
<!-- The variable schemaVersion can be used for further processing. -->
<xsl:attribute name="schemaVersion"><xsl:value-of select="$schemaVersion"/></xsl:attribute>
<Apples>
<xsl:for-each select="/ns2:FruitCatalog/Apples/Apple">
<Apple>
<xsl:attribute name="color"><xsl:value-of select="./@color"/></xsl:attribute>
<xsl:attribute name="type"><xsl:value-of select="./@type"/></xsl:attribute>
<Price><xsl:value-of select="./Price"/></Price>
</Apple>
</xsl:for-each>
</Apples>
</ns2:FruitCatalog>
</xsl:template>
</xsl:stylesheet>
The xml that I am converting using the above xsl format is as below,
<Apples>
<Apple color="green" type="A">
<Price>Dollar_1</Price>
</Apple>
<Apple color="yellow" type="B">
<Price>Dollar_1</Price>
</Apple>
<Apple color="red" type="C">
<Price>Dollar_1</Price>
</Apple>
<Apple color="purple" type="D">
<Price>Dollar_2</Price>
</Apple>
<Apple color="orange" type="E">
<Price>Dollar_2</Price>
</Apple>
<Apple color="blue" type="F">
<Price>Dollar_2</Price>
</Apple>
<Apple color="white" type="G">
<Price>Dollar_2</Price>
</Apple>
<Apple color="black" type="H">
<Price>Dollar_3</Price>
</Apple>
<Apple color="pink" type="I">
<Price>Dollar_3</Price>
</Apple>
<Apple color="brown" type="J">
<Price>Dollar_3</Price>
</Apple>
<Apple color="magenta" type="K">
<Price>Dollar_3</Price>
</Apple>
</Apples>