Show All

# container Attribute

Specifies an XPath expression that determines the context in which the control will be selectable and its actions enabled.

## Type

    xsd:string

## Remarks

The container attribute is an optional attribute of the xmlToEdit element.

If the current context (view selection or insertion point) is within some HTML element that maps back to an XML Document Object Model (DOM) node that satisfies the container XPath expression, the control is enabled. Otherwise, all actions are disabled.

It does not suffice for the container XML DOM node to exist. Actions will be enabled only when the current selection is within an HTML element that maps to the container XML DOM node.

Note In Microsoft Office InfoPath 2003 design mode, generated XPath expressions for the item and container attributes will always be in the form `item="/a/b/c"`, which provides the full path from the root element of the form's underlying XML document. But patterns such as`item="b/c"`, or with predicates as in `item="b[@p='23']/c[q]"` are allowed if the form definition (.xsf) file is edited manually.

## Example

The following is an example of the container attribute as it is used in the xmlToEdit element:

    <xsf:editing>
       <xsf:xmlToEdit name="CD_10"
          item="/CustomUISample/CDCollection/CD"
          container="/CustomUISample">
          <xsf:editWith caption="CD"
             xd:autogeneration="template"
             component="xCollection">
             <xsf:fragmentToInsert>
                <xsf:chooseFragment parent="CDCollection">
                   <CD>
                      <Title></Title>
                      <Artist></Artist>
                      <Tracks>
                         <Track></Track>
                         <Track></Track>
                      </Tracks>
                   </CD>
                </xsf:chooseFragment>
             </xsf:fragmentToInsert>
          </xsf:editWith>
       </xsf:xmlToEdit>
    </xsf:editing>

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp