c:document

<c:document>
  <!-- Content: sequence-constructor -->
</c:document>

Creates a temporary tree.

Category
instruction
Permitted parent elements
Any XCST element whose content model is sequence-constructor
Any literal result element

Remarks

c:document is used to create in-memory documents, also known as temporary trees. It supports two document models: XDocument (which is the default) and XmlDocument.

Example: Creating an XmlDocument
<c:variable name='doc' as='XmlDocument'>
   <c:document>
      <foo bar='123'>baz</foo>
   </c:document>
</c:variable>
<c:assert test='"foo" == doc.DocumentElement.LocalName'/>
<c:assert test='"123" == doc.DocumentElement.GetAttribute("bar")'/>
<c:assert test='"baz" == doc.DocumentElement.InnerText'/>

You can also work with temporary trees rooted at element nodes, using literal result elements or c:element.

Error Conditions

It is a compilation error if the required item type of the containing sequence constructor is not one of, or a super class of, Object, XDocument or XmlDocument.