在一个样式表中收集所有属性集并包含来自 principal.xsl

Gather all attribute-set in one stylesheet and include from principal.xsl

我将有相当多的属性集组合,因为我使用经过解析的 JSON 数据,具有平面层次结构(我需要在 XSL 中构建属性内容)。由于我将 XSL 与文件 principal.xsl 一起模块化作为主要 XSL,因此将属性集的所有变体收集到一个文件中并从 principal.xsl 调用该文件将是有益的。我了解到,在执行包含时,实际会将模板插入 principal.xsl。但属性集不在模板内。

如何将另一个 XSL 文件的属性集加载到 principal.xsl?

如果您包含声明属性集的样式表模块,您应该能够在包含的样式表中使用这些属性集。

https://www.w3.org/TR/xslt-30/#include talks about declarations https://www.w3.org/TR/xslt-30/#dt-declaration 当然 xsl:attribute-set 是您可以包含的一种声明类型。