templates - 为什么模板没有注册?
问题描述
我正在尝试将模板添加到现有的 docbook 系统中,但我不明白整个事情是如何工作的。我想出了如何添加详细日志记录,所以我的简单添加现在生成了大约 250000 行日志输出。我知道语法是正确的,但模板没有添加到系统的其余部分。
这是包含的代码:
?xml version="1.0" encoding="UTF-8"?>
<!-- **********************************************************************
********************************************************************** -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:db="http://docbook.org/ns/docbook"
version='1.0'>
<xsl:template name="mike2">
Add this text
</xsl:template>
<xsl:template match="mike">
<xsl:call-template name="mike2">
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
这是我在日志中看到的内容:
[xsltproc] xsltCompilePattern : parsing 'mike'
[xsltproc] xsltCompilePattern : parsed mike, default priority 0.000000
[xsltproc] added pattern : 'mike' priority 0.000000
[xsltproc] parsed 2 templates
[xsltproc] parsed 0 templates
[xsltproc] Resolving attribute sets references
[xsltproc] Creating sub-dictionary from stylesheet for transformation
[xsltproc] Registered 0 modules
:
:
[xsltproc] Element mike in namespace 'http://docbook.org/ns/docbook' encountered in chapter, but no template matches.
日志显示模板已解析,因此语法正常,但随后显示“已注册 0 个模块”,当它在 *.xml 文件中看到标记时,它会显示“没有模板匹配”。为什么?
谢谢。编辑:xml来源:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter [
<!ENTITY % local_ents SYSTEM "file:///local/entities.ent">
<!ENTITY % product_ents SYSTEM "file:///product/entities.ent">
<!ENTITY % common_ents SYSTEM "file:///common/entities.ent">
<!ENTITY % global_ents SYSTEM "file:///global/entities.ent">
%local_ents;
%product_ents;
%common_ents;
%global_ents;
]>
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0-extension xes-1.0"
xml:id="Memory">
<title>Memory</title>
<mike/>
<para> This is the
<emphasis role="red" >✓ &agr; &aacgr;</emphasis>
</para>
<para><emphasis role="green">memory section of the report. ✓</emphasis>
</para>
</chapter>
解决方案
推荐阅读
- c++ - 如何存储要暴露给 Boost.Python 的类成员
- android - 如何解析 json 数组中的 json 对象?
- sql - Django 查询集过滤器
- spring - 将 Spring Boot 应用程序部署到 Google Cloud Platform 时出错
- makefile - Makefile:605 在 caffe make
- serenity-bdd - 如何使用新场景扩展开始任务
- sql - 在表中保留今天日期的最新记录
- jq - JQ:合并深度数据
- java - Java Spring - 使用 API 持久化对象有效,但我无法在测试中使用服务持久化对象,空指针
- azure - Azure Maps 表达式文档