I have a xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<i xmlns="http://stuff.com" >
<v>
<iNumber>0118</iNumber>
<s>1</s>
<a>24</a>
<p>2175</p>
<p>2175</p>
<p>4534</p>
</v>
</i>
But I need the export to look like this.
<?xml version="1.0" encoding="UTF-8"?>
<i xmlns="http://stuff.com" >
<v>
<iNumber>0118</iNumber>
<s>1</s>
<a>24</a>
<p>2175</p>
</v>
<v>
<iNumber>0118</iNumber>
<s>1</s>
<a>24</a>
<p>2175</p>
</v>
<iNumber>0118</iNumber>
<s>1</s>
<a>24</a>
<p>4534</p>
</v>
</i>
I am new to xslt so I would like some help with transforming this xml please
Here's my attempt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:stuff="http://stuff.com" exclude-result-prefixes="stuff">
<xsl:output version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="stuff:v">
<xsl:copy>
<xsl:copy-of select="ancestor::stuff:v/stuff:p"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I've updated my question to show my attempt