<p>
        To register a sub-template, you include a register directive in the master template. You can include as many Register directives as you like, so one master template can include multiple sub-templates. Sub-templates can be nested.
        </p>

        <pre data-sub="prettyprint:_">
        <%@ Register Name="Header" Template="Header.cst" MergeProperties="True"
        ExcludeProperties="IncludeMeta" %>
        </pre>



        <p>
        The MergeProperties attribute specifies whether the properties of the sub-template should be dynamically added to the master template's properties. If you omit this attribut, it default to false. When you merge the properties, the properties of the sub-template will be displayed on the property sheet of the main template when the main template is open in codesmith explorer or codesmith studio. This makes it easy to prompt for all the properties that are required for the entire code-genertion process on a single propery sheet.
        </p>

        <p>
        You may want to share properties between a master template and sub-templates. Suppose your master template and sub-template both have a string property named "Server", when your prompt for this property in the master template, only the master template's copy of the property receives a value. To set the property in the sub-template, you use the CopyPropertiesTo method of the master template. This method matches properties from the master template to the sub-template on the basis of name and type. If it finds an exact match, it copies the value from the master template to the sub-template.
        </p>


        <pre data-sub="prettyprint:_">
        //instantiate the sub-template
        Header header - this.Create<Header>();

        this.CopyPropertiesTo(header);
        </pre>


        <p>
        If you want to specify a property individually, you can use the following code.
        </p>


        <pre data-sub="prettyprint:_">
        Header header = this.Create<Header>();
        //this is strongly typed template, so that you can use its tempalte directly.

        header.IncludeMeta = true;



        </pre>


        <p>
        However, you don't need to register a template if you don't need to create a strongly type sub template.
        </p>


        <pre data-sub="prettyprint:_">
        CodeTemplate genericTemplate = this.GetCodeTemplateInstance("sub.cst");
        genericTemplate.SetProperty("TemplateName", "Sub template");
        </pre>


        <p> After you've registered a sub-template and set its properties, you can render the sub-template. You can render the sub-template directly to the output of the main template
        </p>


        <pre data-sub="prettyprint:_">
        Header header = this.Create<Header>();
        header.Render(this.Response);
        </pre>


        <p>
        Alternatively, you can render the sub-template to a seperate file. This is useful when you want to create multiple output files as part of a single code-generation process.
        </p>


        <pre data-sub="prettyprint:_">
        Header header = this.Create<Header>();
        header.RenderToFile("SomeFile.txt");
        </pre>

        <p>
        Another way to to use sub-template is to render sub-template to a seperate file. This is useful when you want to create multiple output files as port of single code-generation process.
        </p>


        <pre data-sub="prettyprint:_">
        // instantiate the sub-template
        Header header = this.Create<Header>();
        // render the sub-template to a separate file
        header.RenderToFile("Somefile.txt");
        </pre>


        <p>
        If main template and sub-template share the same base template and main template has all the properties that sub-template has, you don't need to register the sub-template simply because you want to initialized properties in sub-template. All you need to copy the by using "this.CopyPropertiesTo(header);". However if the main template does not have all the properties that sub-template has , you need to register the sub-template , so that use can fill in the properties of sub-template in the main template.
        </p>