xsl这样为什么不可以

davinic1209 2003-10-16 09:19:50
提取author的内容这样为什么不可以?应该怎样?

<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="//author">
<xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>

///////////////////////////////////////////////////////////

<?xml-stylesheet type="text/xsl" href="poem.xsl"?>
<poem>
<author>Rupert Brooke</author>
<date>1912</date>
<title>Song</title>
<stanza>
<line>And suddenly the wind comes soft,</line>
<line>And Spring is here again;</line>
<line>And the hawthorn quickens with buds of green</line>
<line>And my heart with buds of pain.</line>
</stanza>
<stanza>
<line>My heart all Winter lay so numb,</line>
<line>The earth so dead and frore,</line>
<line>That I never thought the Spring would come again</line>
<line>Or my heart wake any more.</line>
</stanza>
<stanza>
<line>But Winter's broken and earth has woken,</line>
<line>And the small birds cry again;</line>
<line>And the hawthorn hedge puts forth its buds,</line>
<line>And my heart puts forth its pain.</line>
</stanza>
</poem>
...全文
63 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
purexu 2003-10-17
  • 打赏
  • 举报
回复
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:value-of select="/poem/author"/>
</xsl:template>
</xsl:stylesheet>
purexu 2003-10-17
  • 打赏
  • 举报
回复
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:template match="//author">
<xsl:value-of select="."/>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
saucer 2003-10-17
  • 打赏
  • 举报
回复
try
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="author">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="/">
<xsl:apply-templates select="//author" />
</xsl:template>

</xsl:stylesheet>

or


<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="//author">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="*">
<xsl:apply-templates select="*" />
</xsl:template>

</xsl:stylesheet>

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧