你能在 document() 函数中有 XSL 变量吗? [英] Can you have XSL variables in the document() function?

查看:29
本文介绍了你能在 document() 函数中有 XSL 变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很好用:

<xsl:variable 
     name="issue_info_file" 
     select="document('/issues/2010/12/08/info.xml')
                /page-components/issue-metadata-component/title"/>

但这不会:

<xsl:variable 
     name="issue_info_file" 
     select="string(concat($full_issue_path,'/info.xml'))"/>
<xsl:variable 
     name="issue_title" 
     select="document($issue_info_file)
                /page-components/issue-metadata-component/title"/>

是否有人在 XSLT 中甚至允许这样做?如果没有,有人推荐使用动态变量打开文件的解决方案吗?

Does anyone if this is even allowed in XSLT? If not, does anyone recommend a solution for opening files with a dynamic variable?

推荐答案

你能在文件中添加 XSL 变量吗?文档()函数?

Can you have XSL variables in the document() function?

.

使用变量作为 document() 函数的参数是完全可以的,只要参数的值是预期的类型(例如 URI).当与 '/info.xml' 连接时,$full_issue_path 的值很可能不会产生有效的 URI 或正确的 URI.

Using variables as arguments of the document() function is perfectly OK, provided the values of the arguments are of the type expected (such as a URI). Most probably the value of $full_issue_path when concatenated with '/info.xml' does not produce a valid URI or the correct URI.

如果你希望人们发现你的错误,你需要提供一个完整的例子.

这篇关于你能在 document() 函数中有 XSL 变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆