在另一个 XSL 样式表中引用 XSL 样式表
我有一个 XSL 样式表,希望使用 xsltc.exe 命令将其编译为 dll。我面临的问题是,有一个正在使用的通用样式表,并且我的样式表正在使用 xsl:include 标记引用该样式表,如下所示:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:include href ="../objectTemplates.xslt"/></xsl:stylesheet>
是否可以将引用的样式表编译到另一个 dll 中并使用它来编译。
因此,如果我将原始样式表编译为“SomeStylesheet.dll”,并将引用的样式表编译为“ObjectTemplate.dll”,
我是否需要将 objectTemplates.xslt 文件的代码复制到第一个 XSLT 文件中并删除 xsl:include 引用,或者我仍然可以为它们提供单独的 xsl 文件,并且仍然使用编译的 XSLT 文件。
任何指示都会非常有帮助。
I have a XSL stylesheet that I wish to compile into a dll using the xsltc.exe command. The issue that I am facing is that there is a common stylesheet that is being used and my styleheet is referencing that stylesheet using the xsl:include tag as shown below:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:include href ="../objectTemplates.xslt"/></xsl:stylesheet>
Is it possible to compile the referenced stylesheet into another dll and use it to compile.
So if I compiled the original stylesheet into "SomeStylesheet.dll" and the referenced stylesheet into "ObjectTemplate.dll"
Do I need to duplicate the code for the objectTemplates.xslt file into the first XSLT file and remove the xsl:include reference or I can still have separate xsl files for them and still use compiled XSLT files.
Any pointers would be really helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在撰写本答案时,XSLT(1.0、2.0 和 2.1 的可用第一个工作草案),如相应的 W3C 规范中所定义,不具备使用对象的能力< /strong>(样式表、全局变量...等)来自外部编译的样式表。
也就是说,如果给定的 XSLT 处理器可以编译样式表,则该样式表只能作为主样式表执行样式表及其编译形式不能被未在同一编译模块中编译的其他样式表导入/包含使用。
如果有必要超越这一点,可以尝试编写自己的扩展函数,以在任何转换和已编译样式表中的模板之间实现一些至少基本的通信。
At the date of writing this answer XSLT (1.0, 2.0 and the avilable first working draft of 2.1) , as defined in the corresponding W3C specifications, doesn't have the capability to use objects (stylesheets, global variables, ..., etc.) from an external compiled stylesheet.
That is, if a given XSLT processor can compile a stylesheet, this stylesheet can be executed only as primary stylesheet and its compiled form cannot be used imported/included by other stylesheets that are not compiled in the same compiled module.
If it is necessary to go beyond this, one could try writing their own extension functions to implement some at least rudimentary communication between any transformation and the templates within the compiled stylesheet.