有没有办法用可选参数调用XSL模板?
例如:
<xsl:call-template name="test">
<xsl:with-param name="foo" select="'fooValue'" />
<xsl:with-param name="bar" select="'barValue'" />
</xsl:call-template>
Run Code Online (Sandbox Code Playgroud)
以及生成的模板定义:
<xsl:template name="foo">
<xsl:param name="foo" select="$foo" />
<xsl:param name="bar" select="$bar" />
<xsl:param name="baz" select="$baz" />
...possibly more params...
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
这段代码会给我一个错误"表达式错误:找不到变量'baz'." 是否可以省略"巴兹"声明?
谢谢你,亨利
我设置了 Jenkins CI 以将我的 PHP 应用程序部署到我们的 QA Apache 服务器,但我遇到了一个问题。我成功设置了从本地jenkins账户到远程apache账户的pubkey认证,但是当我使用的时候rsync,出现如下错误:
[jenkins@build ~]# rsync -avz -e ssh test.txt apache@site.example.com:/path/to/site
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(64) [sender=2.6.8]
[jenkins@build ~]#
Run Code Online (Sandbox Code Playgroud)
一个潜在的问题是远程apache帐户没有有效的 shell 帐户,我应该创建一个具有 shell 访问权限和"apache"组的一部分的远程帐户吗?这不是 SSH 密钥问题,因为ssh apache@site.example.com连接成功,但由于apache没有外壳,很快就把我踢出去了。
这工作得很好:
<xsl:variable
name="issue_info_file"
select="document('/issues/2010/12/08/info.xml')
/page-components/issue-metadata-component/title"/>
Run Code Online (Sandbox Code Playgroud)
但这不会:
<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"/>
Run Code Online (Sandbox Code Playgroud)
有没有人在 XSLT 中甚至允许这样做?如果没有,是否有人推荐使用动态变量打开文件的解决方案?