【问题标题】:How can i make stylesheet-path dynamically?如何动态制作样式表路径?
【发布时间】:2014-04-23 23:46:37
【问题描述】:

我正在尝试从我的 javacode 中进行 XSLT 转换。我想动态地制作样式表路径。但我不能让它与参数 $path 一起工作。我该如何解决它? 提前致谢!

java.code

transformation.setParameter("path", "C:\Users\src");

transformation.xsl

 <xsl:param path="path"/>
  <xsl:include href="$path/config.xsl"/>

【问题讨论】:

  • “C”后缺少冒号?

标签: java xml xslt xslt-1.0


【解决方案1】:

您需要使用 URI 来引用外部资源。试试这个:

transformation.setParameter("path", "file:///C:/Users/src");

请注意,相对路径在 XSLT 中有效。可能根本不需要传入绝对路径。

【讨论】:

  • 我读过:在 的 href 属性中有一个变量引用是非法的
猜你喜欢
  • 1970-01-01
  • 2010-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-01
相关资源
最近更新 更多