В итоге, если выносить все шаблоны в один файл, мы должны были получить следующее:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp " "> ]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="udata[@module = 'comments'][@method = 'insert']">
<span>Нет комментариев</span>
</xsl:template>
<xsl:template match="udata[@module = 'comments'][@method = 'insert'][items/item]">
<xsl:variable name="doc-numpages"
select="document(concat('udata://system/numpages/', total, '/', per_page, '/notemplate/p/10'))/udata" />
<ul class="comments">
<xsl:apply-templates select="items/item" mode="comments.list" />
</ul>
<xsl:apply-templates select="$doc-numpages" mode="paging.words" />
<xsl:apply-templates select="$doc-numpages" mode="paging.numbers" />
</xsl:template>
<xsl:template match="item" mode="comments.list">
<li>
<xsl:value-of select="@num" />.
<span class="title">
<xsl:value-of select="@title" />
</span>
-
<xsl:apply-templates select="document(concat('udata://users/viewAuthor/', @author_id))/udata"/>
<div class="message">
<xsl:value-of select="." disable-output-escaping="yes" />
</div>
</li>
</xsl:template>
<xsl:template match="udata[@module = 'users'][@method = 'viewAuthor']">
<xsl:value-of select="nickname" />
</xsl:template>
<xsl:template match="udata[@module = 'users'][@method = 'viewAuthor'][email]">
<a class="author" href="mailto:{email}">
<xsl:value-of select="nickname" />
</a>
</xsl:template>
<xsl:template match="user">
<xsl:apply-templates select="document(concat('udata://comments/insert/', /result/@pageId))/udata/action"/>
</xsl:template>
<xsl:template match="action">
<h3><a name="addcomment">Добавить комментарий</a></h3>
<form method="post" action="{.}" name="form_addcomment" id="form_addcomment">
<fieldset class="intext">
<label for="comment_title" id="for_title" title="Заголовок">
<span>Заголовок: <sup class="asterisk">*</sup></span>
<input type="text" name="title" id="comment_title" />
</label>
<label for="comment_author">
<span>Ваш ник:</span>
<input type="text" name="author_nick" id="comment_author" />
</label>
<label for="comment_email">
<span>Ваш e-mail:</span>
<input type="text" name="author_email" id="comment_email" />
</label>
<label for="comment_text" id="for_comment" title="Текст">
<span>Текст: <sup class="asterisk">*</sup></span>
<textarea name="comment" id="comment_text" cols="6" />
</label>
</fieldset>
<xsl:apply-templates select="document('udata://system/captcha')/udata[url]" />
<input class="btt submit-send" type="submit" value="отправить"/>
</form>
</xsl:template>
<xsl:template match="user[@status = 'auth']">
<h3><a name="addcomment">Добавить комментарий</a></h3>
<form method="post" action="/comments/post/{/result/@pageId}/" name="form_addcomment" id="form_addcomment">
<fieldset class="intext">
<label for="comment_title" id="for_title" title="Заголовок">
<span>Заголовок: <sup class="asterisk">*</sup></span>
<input type="text" name="title" id="comment_title" />
</label>
<label for="comment_text" id="for_comment" title="Текст">
<span>Текст: <sup class="asterisk">*</sup></span>
<textarea name="comment" id="comment_text" cols="6" />
</label>
</fieldset>
<input class="submit-send" type="submit" value="Отправить"/>
</form>
</xsl:template>
<xsl:template match="udata[@module = 'system'][@method = 'captcha']">
<fieldset>
<legend>Введите символы защиты от автосозданий <sup class="asterisk">*</sup></legend>
<label for="captcha" id="for_captcha" title="Защитный код">
<div class="input"><input type="text" name="captcha" id="captcha" /></div>
<span><img src="{url}{@random_string}" /></span>
</label>
</fieldset>
</xsl:template>
</xsl:stylesheet>