Subject:convert XML to XML via XSLT Author:JJJ JJJ Date:21 Oct 2005 10:53 AM
Hi
I am trying to convert 1 XML file into another.
For example, I need to convert:
<aa>
<a>
<nameid>123</nameid>
<dob>2005-10-10</dob>
</a>
</aa>
<bb>
<b>
<nameid>123</nameid>
<address>blah</address>
</b>
</bb>
So every time the element bb or b occurs, I need to transform some of its data as it it was an occurrence of the aa and a elements.
I have tried doing this in the mapper on Stylus but on adding an XSLT for-each instruction i get the error "Target node already has a control link".
DO you know of a way rund this or the actual XSLT code?
Many thanks.
if you'd like to match <a> and <b> based on the value of <nameid> XSLT will be different. Let us know if this is the case - we will post example which will handle this too.
Now, just under where the </candidate> occurs I need to apply a loop so that for each time the <canvat> element occurs it instead creates a new <candidate> element.
Subject:convert XML to XML via XSLT Author:JJJ JJJ Date:24 Oct 2005 07:06 AM Originally Posted: 24 Oct 2005 07:05 AM
I have done the following and it seemed to work...
...
</candidate>
</xsl:for-each>
<xsl:for-each select="../canvats/canvat">
<candidate>
<empid>
<xsl:value-of select="empid"/>
</empid>
<companynumber>
<xsl:value-of select="companynumber"/>
</companynumber>
<vatnumber>
<xsl:value-of select="vatnumber"/>
</vatnumber>
</candidate>
</xsl:for-each>
</candidates>
Are there any potential problems with this or is the solution okay?<br>
Thanks.