c:script

<c:script
  src? = uri >
  <!-- Content: text -->
</c:script>

Embeds or references a script of code.

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

Attributes

src The relative or absolute URI of the script of code.

In addition to the attributes in the preceding table, there are a number of standard attributes that may appear on any XCST element.

Example: Fetching Data to Pass to Other Templates
<c:template name='c:initial-template'>
   <c:script>
      <![CDATA[
      
      int id;
      Product product;
      
      if (!int.TryParse(UrlData[0], out id)
         || (product = Edit(id)) == null) {

         Response.StatusCode = 404;
         return;
      }
      ]]>
   </c:script>
   <c:next-template>
      <c:with-param name='product' value='product' tunnel='yes'/>
   </c:next-template>
</c:template>

Error Conditions

It is a compilation error if the src attribute is present when the content of the element is non-empty.

See Also