Provisioning Schema::forEach
Element that encapsulates a processing loop for a provisioning procedure. Specifies the data source for the loop and how to handle errors. This element is part of the provisioning schema of Microsoft. Provisioning Framework (MPF).
Parents
Attributes
- ifNull
- Optional. Enumeration that specifies how the forEach loop reacts if the node specified by the attributes root and path is not present.
- "fail" (default): Returns a failure.
- "skip": Skips execution for the current iteration of the loop.
- "ignore": Treats the incoming node as optional and continues executing the procedure.
- name
- Required. Name of the forEach node. The forEach node names must be unique within an execute element.
- path
- Optional. XPath offset from the element specified by the root attribute. If path is not specified, the forEach loop starts from the root node.
- root
- Required. Starting element for the forEach iteration.
- "data" (the request's data node)
- "procedureData" (for the current procedure step)
- Name of a previous forEach node
Example
In the following example, MPF calls the Write Request procedure for each organization and user in the data node. The ifNull="skip" attribute in the forEach node for name="user" instructs MPF to skip execution for the current iteration rather than fail the entire request whenever an organization does not have a user.
<request> <data> <organizations> <organization name="tailspintoys.com" type="primary" > <user name="joe"/> <user name="nancy"/> </organization> <organization name="wideworldimporters.com" type="primary"> <user name="fred"/> </organization> <organization name="fourthcoffee.com" type="secondary"> </organization> <organization name="adventure-works.com" type="secondary"> </organization> </organizations> </data> <procedure> <execute namespace="Test Namespace" procedure="Write Request"> <forEach name="organization" root="data" path="organizations/organization"/> <forEach name="user" root="organization" path="user" ifNull="skip"/> <before source="organization" destination="executeData"> <xsl:template match="organization[@type='primary']"> <primaryOrg> <xsl:value-of select="@name"/> </primaryOrg> </xsl:template> <xsl:template match="organization[@type='secondary']"> <secondaryOrg> <xsl:value-of select="@name"/> </secondaryOrg> </xsl:template> </before> <after source="executeData" destination="data" destinationPath="orgSignup" mode="merge"/> </execute> </procedure> </request>See also
Customization, Procedure Examples, XML Schema for Procedures
Top of Page
) 1999-2002 Microsoft Corporation. All rights reserved.