如何将 xsl:import 与路径名中的变量一起使用? [英] How can I use xsl:import with a variable in the path name?

查看:17
本文介绍了如何将 xsl:import 与路径名中的变量一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想在 XSL 中做到这一点:

Essentially I want do this in XSL:

<xsl:include href="_domains/{$domain}/templates/header.xsl" />

但我似乎无法在包含中使用变量 ($domain).关于解决方法的任何建议?

But I can't seem to use a variable ($domain) in the include. Any suggestions on a work around?

推荐答案

xsl:importxsl:include 在编译时解析,不支持运行时扩展.

xsl:import and xsl:include are resolved at compile time, and do not support runtime expansion.

除此之外,如果您使用的是 XSLT 2.0,则可以使用 条件包含 使用 use-when,如果您有可以在静态上下文中计算的表达式.

Except, if you are using XSLT 2.0, you can use conditional inclusion with use-when, if you have an expression that can be evaluated in a static context.

这篇关于如何将 xsl:import 与路径名中的变量一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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