split an XML to individual nodes using XSLT

Post Reply
abonsey
Member
Posts: 142
Joined: Fri May 24, 2013 5:10 pm

split an XML to individual nodes using XSLT

Post by abonsey »

Hi All,
I'm trying to split a supplied XML to individual orders but can't extract based on a specific field.
Below is my supplied XML
<CudosOrders>
<CudosOrder OrderID="647105">
<OrderReference>276945</OrderReference>
<CustomHeadFields>
<CustomHeadField0><![CDATA[Nicky]]></CustomHeadField0>


Here is the extract from my XSLT. I'm trying to split it based on OrderID but I guess I've coded it wrong.
<xsl:template match="/CudosOrders/CudosOrder/">
<xsl:result-document method="xml" href="{@Type='OrderID'}.xml">
<xsl:copy-of select="." />
</xsl:result-document>
</xsl:template>
...

Any advice??

Thanks
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: split an XML to individual nodes using XSLT

Post by freddyp »

The attribute is called OrderID, not Type, so it should be

Code: Select all

@OrderID
instead of

Code: Select all

@Type='OrderID'
abonsey
Member
Posts: 142
Joined: Fri May 24, 2013 5:10 pm

Re: split an XML to individual nodes using XSLT

Post by abonsey »

Hi,
Thanks for that. All working fine now.
Post Reply