This article provides step-by-step instructions for two methods that you can use to create a recursive data source structure and a view in InfoPath 2003:
- Method 1: Modify the Manifest.xsf file
- Method 2: Use script
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.
View products that this article applies to.
<xsf:xmlToEdit name="Genealogy_2" item="/my:myFields/my:Genealogy/my:Genealogy"
container="/my:myFields/my:Genealogy">
<xsf:xmlToEdit name="Genealogy_2" item="my:Genealogy" container="my:Genealogy">
<xsf:xmlToEdit name="Genealogy_2" item="my:Genealogy" container="my:Genealogy">
<xsf:editWith caption="Genealogy" xd:autogeneration="template"
component="xCollection">
<xsf:fragmentToInsert>
<xsf:chooseFragment>
<my:Genealogy>
<my:FirstName></my:FirstName>
<my:LastName></my:LastName>
<my:SpouseFirstName></my:SpouseFirstName>
<my:SpouseLastName></my:SpouseLastName>
</my:Genealogy>
</xsf:chooseFragment>
</xsf:fragmentToInsert>
</xsf:editWith>
</xsf:xmlToEdit>
<xsf:xmlToEdit name="Genealogy_3" item="my:Genealogy"
container="my:Genealogy[my:Genealogy]">
<xsf:editWith caption="Genealogy" xd:autogeneration="template"
component="xCollection">
<xsf:fragmentToInsert>
<xsf:chooseFragment>
<my:Genealogy>
<my:FirstName></my:FirstName>
<my:LastName></my:LastName>
<my:SpouseFirstName></my:SpouseFirstName>
<my:SpouseLastName></my:SpouseLastName>
</my:Genealogy>
</xsf:chooseFragment>
</xsf:fragmentToInsert>
</xsf:editWith>
</xsf:xmlToEdit>
<xsf:button action="xCollection::insert" xmlToEdit="Genealogy_3"
caption="Genealogy"></xsf:button>
<xsf:button action="xCollection::remove" xmlToEdit="Genealogy_3"
caption="Remove Genealogy"></xsf:button>
<xsf:button action="xCollection::insertBefore" xmlToEdit="Genealogy_3"
caption="Insert Genealogy above" showIf="immediate"></xsf:button>
<xsf:button action="xCollection::insertAfter" xmlToEdit="Genealogy_3"
caption="Insert Genealogy below" showIf="immediate"></xsf:button>
<xsf:button action="xCollection::remove" xmlToEdit="Genealogy_3"
caption="Remove Genealogy" showIf="immediate"></xsf:button>
<xsf:button action="xCollection::insert" xmlToEdit="Genealogy_3"
caption="Insert Genealogy" showIf="immediate"></xsf:button>
<xsl:template match="my:Genealogy" mode="_1">
<div class="xdRepeatingSection xdRepeating" title=""
style="MARGIN-BOTTOM: 6px; WIDTH: 100%" align="left"
xd:xctname="RepeatingSection" xd:CtrlId="CTRL6" tabIndex="-1">
<div>First Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL7" tabIndex="0"
xd:binding="my:FirstName" style="WIDTH: 130px">
<xsl:value-of select="my:FirstName"/>
</span>
</div>
<div>Last Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL8" tabIndex="0"
xd:binding="my:LastName" style="WIDTH: 130px">
<xsl:value-of select="my:LastName"/>
</span>
</div>
<div>Spouse First Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL9" tabIndex="0"
xd:binding="my:SpouseFirstName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseFirstName"/>
</span>
</div>
<div>Spouse Last Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL10" tabIndex="0"
xd:binding="my:SpouseLastName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseLastName"/>
</span>
</div>
<div><xsl:apply-templates select="my:Genealogy" mode="_2"/>
</div>
</div>
</xsl:template>
<xsl:template match="my:Genealogy" mode="_1">
<div class="xdRepeatingSection xdRepeating" title=""
style="MARGIN-BOTTOM: 6px; WIDTH: 100%" align="left"
xd:xctname="RepeatingSection" xd:CtrlId="CTRL6" tabIndex="-1">
<div>First Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL7" tabIndex="0"
xd:binding="my:FirstName" style="WIDTH: 130px">
<xsl:value-of select="my:FirstName"/>
</span>
</div>
<div>Last Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL8" tabIndex="0"
xd:binding="my:LastName" style="WIDTH: 130px">
<xsl:value-of select="my:LastName"/>
</span>
</div>
<div>Spouse First Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL9" tabIndex="0"
xd:binding="my:SpouseFirstName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseFirstName"/>
</span>
</div>
<div>Spouse Last Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL10" tabIndex="0"
xd:binding="my:SpouseLastName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseLastName"/>
</span>
</div>
<div><xsl:apply-templates select="my:Genealogy" mode="_1"/>
</div>
</div>
</xsl:template>
<xsl:template match="my:Genealogy" mode="_2">
<div class="xdRepeatingSection xdRepeating" title=""
style="MARGIN-BOTTOM: 6px; WIDTH: 100%" align="left"
xd:xctname="RepeatingSection" xd:CtrlId="CTRL6" tabIndex="-1">
<div>First Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL7" tabIndex="0"
xd:binding="my:FirstName" style="WIDTH: 130px">
<xsl:value-of select="my:FirstName"/>
</span>
</div>
<div>Last Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL8" tabIndex="0"
xd:binding="my:LastName" style="WIDTH: 130px">
<xsl:value-of select="my:LastName"/>
</span>
</div>
<div>Spouse First Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL9" tabIndex="0"
xd:binding="my:SpouseFirstName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseFirstName"/>
</span>
</div>
<div>Spouse Last Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL10" tabIndex="0"
xd:binding="my:SpouseLastName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseLastName"/>
</span>
</div>
<div> </div>
</div>
</xsl:template>
var copiedNode;
function Remove_Node::OnClick(eventObj)
{
eventObj.Source.parentNode.removeChild(eventObj.Source);
}
function Copy_Node::OnClick(eventObj)
{
copiedNode = eventObj.Source.cloneNode(true);
}
function Paste_Node::OnClick(eventObj)
{
eventObj.Source.appendChild(copiedNode);
}
function Insert_Node::OnClick(eventObj)
{
var newnode = eventObj.Source.cloneNode(true);
var fragnodes = newnode.selectNodes("/my:Genealogy");
if(fragnodes.length>=1)
{
for(i=0;i<fragnodes.length;i++)
{
newnode.removeChild(fragnodes.item(i));
}
}
newnode.selectSingleNode("/my:FirstName").text = "";
newnode.selectSingleNode("/my:LastName").text = "";
newnode.selectSingleNode("/my:SpouseFirstName").text = "";
newnode.selectSingleNode("/my:SpouseLastName").text = ""
eventObj.Source.appendChild(newnode);
}
<xsl:template match="my:Genealogy" mode="_1">
<div class="xdRepeatingSection xdRepeating" title=""
style="MARGIN-BOTTOM: 6px; WIDTH: 542px" align="left"
xd:xctname="RepeatingSection" xd:CtrlId="CTRL1" tabIndex="-1">
<div>First Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL5" tabIndex="0"
xd:binding="my:FirstName" style="WIDTH: 130px">
<xsl:value-of select="my:FirstName"/>
</span>
</div>
<div>Last Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL6" tabIndex="0"
xd:binding="my:LastName" style="WIDTH: 130px">
<xsl:value-of select="my:LastName"/>
</span>
</div>
<div>Spouse First Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL7" tabIndex="0"
xd:binding="my:SpouseFirstName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseFirstName"/>
</span>
</div>
<div>Spouse Last Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL8" tabIndex="0"
xd:binding="my:SpouseLastName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseLastName"/>
</span>
</div>
<div><input class="langFont" title=""
style="WIDTH: 114px; HEIGHT: 30px" type="button" size="3"
value="Insert Node" xd:xctname="Button" xd:CtrlId="Insert_Node"
tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 141px; HEIGHT: 30px"
type="button" size="1" value="Remove Node" xd:xctname="Button"
xd:CtrlId="Remove_Node" tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 102px; HEIGHT: 30px"
type="button" size="3" value="Copy Node" xd:xctname="Button"
xd:CtrlId="Copy_Node" tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 119px; HEIGHT: 30px"
type="button" size="6" value="Paste Node" xd:xctname="Button"
xd:CtrlId="Paste_Node" tabIndex="0"/>
</div>
<div><xsl:apply-templates select="my:Genealogy" mode="_2"/>
</div>
<div>�</div>
</div>
</xsl:template>
<xsl:template match="my:Genealogy" mode="_1">
<div class="xdRepeatingSection xdRepeating" title=""
style="MARGIN-BOTTOM: 6px; WIDTH: 542px" align="left"
xd:xctname="RepeatingSection" xd:CtrlId="CTRL1" tabIndex="-1">
<div>First Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL5" tabIndex="0"
xd:binding="my:FirstName" style="WIDTH: 130px">
<xsl:value-of select="my:FirstName"/>
</span>
</div>
<div>Last Name: <span class="xdTextBox" hideFocus="1" title=""
xd:xctname="PlainText" xd:CtrlId="CTRL6" tabIndex="0"
xd:binding="my:LastName" style="WIDTH: 130px">
<xsl:value-of select="my:LastName"/>
</span>
</div>
<div>Spouse First Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL7" tabIndex="0"
xd:binding="my:SpouseFirstName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseFirstName"/>
</span>
</div>
<div>Spouse Last Name: <span class="xdTextBox" hideFocus="1"
title="" xd:xctname="PlainText" xd:CtrlId="CTRL8" tabIndex="0"
xd:binding="my:SpouseLastName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseLastName"/>
</span>
</div>
<div><input class="langFont" title=""
style="WIDTH: 114px; HEIGHT: 30px" type="button" size="3"
value="Insert Node" xd:xctname="Button" xd:CtrlId="Insert_Node"
tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 141px; HEIGHT: 30px"
type="button" size="1" value="Remove Node" xd:xctname="Button"
xd:CtrlId="Remove_Node" tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 102px; HEIGHT: 30px"
type="button" size="3" value="Copy Node" xd:xctname="Button"
xd:CtrlId="Copy_Node" tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 119px; HEIGHT: 30px"
type="button" size="6" value="Paste Node" xd:xctname="Button"
xd:CtrlId="Paste_Node" tabIndex="0"/>
</div>
<div><xsl:apply-templates select="my:Genealogy" mode="_1"/>
</div>
<div>�</div>
</div>
</xsl:template>
<xsl:template match="my:Genealogy" mode="_2">
<div class="xdRepeatingSection xdRepeating" title=""
style="MARGIN-BOTTOM: 6px; WIDTH: 542px" align="left" xd:CtrlId="CTRL1"
xd:xctname="RepeatingSection" tabIndex="-1">
<div>First Name: <span class="xdTextBox" hideFocus="1" title=""
tabIndex="0" xd:CtrlId="CTRL5" xd:xctname="PlainText"
xd:binding="my:FirstName" style="WIDTH: 130px">
<xsl:value-of select="my:FirstName"/>
</span>
</div>
<div>Last Name: <span class="xdTextBox" hideFocus="1" title=""
tabIndex="0" xd:CtrlId="CTRL6" xd:xctname="PlainText"
xd:binding="my:LastName" style="WIDTH: 130px">
<xsl:value-of select="my:LastName"/>
</span>
</div>
<div>Spouse First Name: <span class="xdTextBox" hideFocus="1"
title="" tabIndex="0" xd:CtrlId="CTRL7" xd:xctname="PlainText"
xd:binding="my:SpouseFirstName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseFirstName"/>
</span>
</div>
<div>Spouse Last Name: <span class="xdTextBox" hideFocus="1"
title="" tabIndex="0" xd:CtrlId="CTRL8" xd:xctname="PlainText"
xd:binding="my:SpouseLastName" style="WIDTH: 130px">
<xsl:value-of select="my:SpouseLastName"/>
</span>
</div>
<div><input class="langFont" title=""
style="WIDTH: 114px; HEIGHT: 30px" type="button" size="3"
value="Insert Node" xd:CtrlId="Insert_Node" xd:xctname="Button"
tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 141px; HEIGHT: 30px"
type="button" size="1" value="Remove Node" xd:CtrlId="Remove_Node"
xd:xctname="Button" tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 102px; HEIGHT: 30px"
type="button" size="3" value="Copy Node" xd:CtrlId="Copy_Node"
xd:xctname="Button" tabIndex="0"/>
<input class="langFont" title="" style="WIDTH: 119px; HEIGHT: 30px"
type="button" size="6" value="Paste Node" xd:CtrlId="Paste_Node"
xd:xctname="Button" tabIndex="0"/>
</div>
<div>�</div>
<div>�</div>
</div>
</xsl:template>
Keywords: KB832122, kbhowto