Share via


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.

Bb230398.vs_note(en-us,office.12).gif  Note
In Microsoft Office InfoPath 2007 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.
  item="/a/b/c"
   item="b/c"
  item="b[@p='23']/c[q]"

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>