<s1 title="xsl:apply-templates">

<p>Most stylesheet templates generate HTML elements with content.
The previous Hello, World example just replaced an empty tag &lt;hello>
with some text.  Any content of the &lt;hello> tag was ignored.
XSL uses &lt;xsl:apply-templates> to evaluate the children of an element.

<p>The following stylesheet creates a &lt;note> tag whose content is
evaluated using the normal XSL processing.  In the example,
every &lt;note> tag is replaced with "Note: " and emphasizes the
contents of the tag.</p>

<example title='default.xsl'>
&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

&lt;xsl:template match="note">
  &lt;xsl:text>Note: &lt;/xsl:text>
  &lt;em>
    &lt;xsl:apply-templates/>
  &lt;/em>
&lt;/xsl:template>

&lt;xsl:template match="hello">
  &lt;xsl:text>Hello, World!&lt;/xsl:text>
&lt;/xsl:template>

&lt;/xsl:stylesheet>
</example>

<p>Since the XSL engine will evaluate the contents of the &lt;note>,
it will replace the &lt;hello> from the previous example with
the "Hello, World" text.  By creating tags like &lt;note>, you can
change the look of a page or an entire site by changing the stylesheet.
All the &lt;note> instances will be automatically reformatted.  With Serif,
you can modify the stylesheet and immediately browse the site to see how
it looks.  The feedback is immediate.</p>

<example title='hello.xtp'>
This is a plain, old description.

&lt;note>The first example is &lt;hello/>&lt;/note>
</example>
<results>
This is a plain, old description.

Note: &lt;em>The first example is Hello, world!&lt;/em>
</results>

<s2 title="StyleScript equivalent">

<p>The StyleScript equivalent is <var/$apply-templates();/>.  The function
notation, $<var/foo/>() expands to an xsl:<var/foo/> element.  The&nbsp;';'
tells StyleScript that the tag is empty.  For a tag with contents, use <var/&lt;&lt;...>>/>.</p>

<example title='default.xsl'>
$template(note) &lt;&lt;
Note: &lt;em>$apply-templates();&lt;/em>
>>

$template(hello) &lt;&lt;Hello, World!>>
</example>

</s2>

<s2 title="Summary">

<ul>
<li><var/xsl:apply-templates/> processes the current node's children.
<li>You can add tags, like <var/&lt;em>/>, directly to the stylesheet.
<li><var/$apply-templates();/> expands to <var/&lt;xsl:apply-templates/&gt;/>
</ul>

</s2>
</s1>
