RE: Mapping recursive elements
- From: Thiago <Thiago@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Sep 2007 15:00:01 -0700
If you want to copy it exactly as it is and the source nodes have the exact
same names as the destination you can use the mass copy functoid.
The mass copy functoid copies the namespace of the original XML to the
destination XML though. Try it, and if the namespace is a problem you can use
a scripting functoid. The following code is what I have in a "Inline XSLT
Call Template" scripting functoid that copies the entire "catalogueItem" node
structure that is a child of a "catalogueItemNotification" node onto a
destination "Document" node. The functoid has no input parameters but the
destination links to the "Document" node on the destination schema.
<xsl:template name = "testTemplate"
match="/*[local-name()='catalogueItemNotification' and
namespace-uri()='urn:ean.ucc:gdsn:2']/*">
<xsl:element name="Document">
<xsl:apply-templates mode="copy-no-ns" select="catalogueItem"/>
</xsl:element>
</xsl:template>
<!-- Selectively mass copy some of the nodes without namespaces -->
<xsl:template mode="copy-no-ns" match="*">
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="copy-no-ns"/>
</xsl:element>
</xsl:template>
So if the original document had:
<catalogueItemNotification>
<catalogueItem>
<.... a whole bunch of nodes and attributes ...>
</catalogueItem>
<catalogueItemNotification>
The destination will have:
<ParentNode>
<Document>
<.... exact copy of a whole bunch of nodes and attributes ...>
</Document>
</ParentNode>
"Sree" wrote:
I have a schema with a recursive record element..
<Workflow Id="Id_0" MajorVersion="MajorVersion_1"
MinorVersion="MinorVersion_2">
<Workflow Id="Id_0" MajorVersion="MajorVersion_1"
MinorVersion="MinorVersion_2" />
<Workflow Id="Id_0" MajorVersion="MajorVersion_1"
MinorVersion="MinorVersion_2" />
</Workflow>
</Workflow>
I need to map this record to another schema. I tried using the shift
and drag link method to have all the child nodes mapped but that does
only one level deep mapping. How do I achieve N level deep mapping for
this recursive record.
The destination record struct is exactly as the source record
structure. It does not make sense to have to do a one to one mapping
dragging a link, because of the record being recursive.
All help is great help.
Thanks
Sree
- Prev by Date: Re: Xpath error
- Next by Date: RE: BizTalk WMI performance issue
- Previous by thread: Re: Xpath error
- Next by thread: RE: msdtc ERROR
- Index(es):
Relevant Pages
|