我是 XSL 的新手,这很明显,一些非常基本的东西让我很困惑。假设我有一个如下所示的 XML 文档:
<?xml version="1.0" encoding="UTF-8"?>
<essay><author>John Stamos</author>
<text>
<p>In his song "Turn! Turn! Turn!," Bob Dylan quotes the Bible:
<quotation>"To every thing there is a season, and a time to every purpose under the
heaven,"</quotation> which is a well-known quotation from Ecclesiastes.
</p>
</text>
</essay>
对于我目前的目的,我想标记元素中的文本<p>
以及<quotation>
元素并只打印这些。IE,我想要输出
<span id="paragraph">In his song "Turn! Turn! Turn!," Bob Dylan quotes the Bible:
<span id="quotation">"To every thing there is a season, and a time to every purpose under the
heaven,"</span> which is a well-known quotation from Ecclesiastes.</span>
但是,当我使用如下样式表时,我遇到了麻烦:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-
c.org/ns/1.0"
version="1.0">
<xsl:template match="/">
<xsl:apply-templates select="//text"/>
</xsl:template>
<xsl:template match="p">
<span id="paragraph"><xsl:value-of select="//p"/></span>
</xsl:template>
<xsl:template match="quotation">
<span id="quotation"><xsl:value-of select="//quotation"/></span>
</xsl:template>
</xsl:stylesheet>
报价模板永远不会被调用;p,它的父级,显然优先。我该怎么做呢?