http://www.w3.org/TR/xslt中的这句完全没法搞懂!谁解释一下?

大可山人
博客专家认证
2004-04-04 01:41:30
The key can be used to retrieve a key from a document other than the document containing the context node. For example, suppose a document contains bibliographic references in the form <bibref>XSLT</bibref>, and there is a separate XML document bib.xml containing a bibliographic database with entries in the form:

<entry name="XSLT">...</entry>
Then the stylesheet could use the following to transform the bibref elements:

<xsl:key name="bib" match="entry" use="@name"/>

<xsl:template match="bibref">
<xsl:variable name="name" select="."/>
<xsl:for-each select="document('bib.xml')">
<xsl:apply-templates select="key('bib',$name)"/>
</xsl:for-each>
</xsl:template>

举例说明一下,好吗?
...全文
129 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ssm1226 2004-04-06
  • 打赏
  • 举报
回复
单独来理解

document是XSLT中提供一个引用另外一个XML文件的函数,可以识其所引用的XML为当前XML文件的一部分

而key的作用只是匹配
ssm1226 2004-04-05
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xsl_elm_gp_9ylh.asp
大可山人 2004-04-05
  • 打赏
  • 举报
回复
请高手帮忙呀!
大可山人 2004-04-05
  • 打赏
  • 举报
回复
雨中人来解决问题就好办了。
其中我主要是搞不清楚document()引用其他文档后再使用key()的问题,能再说详细点吗?
谢谢!
lonlykiller 2004-04-04
  • 打赏
  • 举报
回复
用xslt打开另外一个xml,并且输出。
<xsl:key>什么东西。。。不懂。。。
hacker18 2004-04-04
  • 打赏
  • 举报
回复
up

ICQ:348732090
BeginnerBBB 2004-04-04
  • 打赏
  • 举报
回复
我也不会,关注一下~

8,906

社区成员

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

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