开发者

Referencing an XSL Stylesheet within another

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜