Is there a kind of include once in XSLT?

2019-07-17 22:44发布

问题:

I have FileA, FileB and FileC.

FileA includes FileB and FileC.
FileC includes FileB.

Is there an kind of include-once functionality in XSLT 1.0?

回答1:

If you use <xsl:import> instead of <xsl:include> there would be no error.

As the W3C XSLT 1.0 specification says:

"It is an error if a stylesheet directly or indirectly imports itself. Apart from this, the case where a stylesheet with a particular URI is imported in multiple places is not treated specially."



回答2:

You should remove the redundant xsl:include directives so each module is included only once. FileC does not need to xs:include FileB, even if it references components in FileB.



标签: xslt