I am facing a problem with my XSLT transformation. I want to transform xml from one form to other. My Input XML root tag is .
Input XML:
<ICWRRsp>
<IcwrId>379505</IcwrId>
<IcwrId>379506</IcwrId>
<IcwrId>379507</IcwrId>
<IcwrId>379508</IcwrId>
<IcwrId>379509</IcwrId>
<IcwrId>379510</IcwrId>
<WorkId>1920305</WorkId>
<WorkId>1920475</WorkId>
<WorkId>1920673</WorkId>
<WorkId>1920676</WorkId>
<WorkId>1920717</WorkId>
<WorkId>1920729</WorkId>
<Jurisdiction>V1</Jurisdiction>
<Jurisdiction>V1</Jurisdiction>
<Jurisdiction>V1</Jurisdiction>
<Jurisdiction>V1</Jurisdiction>
<Jurisdiction>MD</Jurisdiction>
<Jurisdiction>MD</Jurisdiction>
<IcgsWc>0FCC</IcgsWc>
<IcgsWc>0FCC</IcgsWc>
<IcgsWc>0FCC</IcgsWc>
<IcgsWc>0FCC</IcgsWc>
<IcgsWc>0FEN</IcgsWc>
<IcgsWc>0FEN</IcgsWc>
<WcId>0</WcId>
<WcId>0</WcId>
<WcId>0</WcId>
<WcId>0</WcId>
<WcId>0</WcId>
<WcId>0</WcId>
<StatusCode>0</StatusCode>
<StatusDesc>SUCESS</StatusDesc>
</ICWRRsp>
Output XML:
<ICWRRsp>
<ICWR>
<IcwrId>379505</IcwrId>
<WorkId>1920305</WorkId>
<Jurisdiction>V1</Jurisdiction>
<IcgsWc>0FCC</IcgsWc>
<WcId>0</WcId>
</ICWR>
<ICWR>
<IcwrId>379505</IcwrId>
<Jurisdiction>V1</Jurisdiction>
<IcgsWc>0FCC</IcgsWc>
<WcId>0</WcId>
</ICWR>
<StatusCode>0</StatusCode>
<StatusDesc>SUCESS</StatusDesc>
XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ICWRRsp>
<xsl:for-each select="ICWRRsp">
<ICWR>
<IcwrId><xsl:value-of select="IcwrId"/></IcwrId>
<WorkId><xsl:value-of select="WorkId"/></WorkId>
<Jurisdiction><xsl:value-of select="Jurisdiction"/></Jurisdiction>
<IcgsWc><xsl:value-of select="IcgsWc"/></IcgsWc>
<WcId><xsl:value-of select="WcId"/></WcId>
</ICWR>
</xsl:for-each>
</ICWRRsp>
</xsl:template>
</xsl:stylesheet>
I have written the XSLT, but It's not iterating. I am stuck in looping. I am getting the following output:
<?xml version="1.0" encoding="UTF-8"?>
<ICWRRsp>
<ICWR>
<IcwrId>379505</IcwrId>
<WorkId>1920305</WorkId>
<Jurisdiction>V1</Jurisdiction>
<IcgsWc>0FCC</IcgsWc>
<WcId>0</WcId>
</ICWR>
</ICWRRsp>
Can anyone please help me to write the XSLT?