任何通过指向 Antenna House 的 xsl-fo 扩展名的命名空间(这会给出“页面未找到”)的尝试都会导致错误:
命名空间“http://www.w3.org/1999/XSL/Format”中的元素“root”在命名空间“http://www.antennahouse.com/names”中具有无效的子元素“document-info” /XSL/扩展'。预期可能的元素列表:命名空间“http://www.w3.org/1999/XSL/Format”中的“layout-master-set”。
似乎存在某种类型的命名空间引用问题,其中 xsl-fo 命名空间中的元素无法识别扩展元素是有效的子元素?
代码如下所示:
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:axf='http://www.antennahouse.com/names/XSL/Extensions'>
<xsl:template match='/root'>
<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format' xmlns:axf='http://www.antennahouse.com/names/XSL/Extensions'>
<axf:document-info name='title' value='value' />
</fo:root>
</xsl:template>
</xsl:stylesheet>
有趣的是,他们在其网站上列出了一个示例,看起来与此处完全相同:http://www.antennahouse.com/xslfo/axf4-extension.htm#axf.document-info
不幸的是,它似乎不适用于他们的 xsl v4.3格式化程序。
Any attempt to use Antenna House's xsl-fo extensions by pointing to their namespace (which gives a "page not found" btw) results in an error:
The element 'root' in namespace 'http://www.w3.org/1999/XSL/Format' has invalid child element 'document-info' in namespace 'http://www.antennahouse.com/names/XSL/Extensions'. List of possible elements expected: 'layout-master-set' in namespace 'http://www.w3.org/1999/XSL/Format'.
It appears that there's some type of namespace referencing issue where the elements in the xsl-fo namespace don't recognize that the extension elements are valid child elements?
Code looks like such:
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:axf='http://www.antennahouse.com/names/XSL/Extensions'>
<xsl:template match='/root'>
<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format' xmlns:axf='http://www.antennahouse.com/names/XSL/Extensions'>
<axf:document-info name='title' value='value' />
</fo:root>
</xsl:template>
</xsl:stylesheet>
Funny that they have an example listed on their website that looks exactly the same here: http://www.antennahouse.com/xslfo/axf4-extension.htm#axf.document-info
Unfortunately it doesn't seem to be working with v4.3 of their xsl formatter.
发布评论
评论(3)
我认为问题可能是 xsl-fo 不完整。错误是在将 XML 转换为 XSL-FO 时发生还是在处理 XSL-FO 时发生?
另外,我认为您不需要将命名空间添加到
fo:root
元素(如果它们位于xsl:stylsheet
中)。但这可能是 XSL 处理器特有的。 (我正在使用 Saxon。)我没有任何使用 Antenna House 的经验,但我使用具有类似扩展的 RenderX。
下面是 XML 文件、XSL 样式表和生成的 XSL-FO 的示例。 (这在 RenderX 中工作得很好。)
XML 文件
XSL 样式表
XSL-FO 输出
我想如果你交换 renderx 扩展 (
rx :
) 对于天线室扩展,它应该可以工作。也许您应该先尝试渲染 XSL-FO,然后再尝试使用 XSL-T 生成 XSL-FO。希望这有帮助。
I think that the issue might be that the xsl-fo is not complete. Does the error occur when transforming the XML to XSL-FO or does it occur when processing the XSL-FO?
Also, I don't think you need to add the namespaces to the
fo:root
element if they're inxsl:stylsheet
. This might be specific to the XSL processor though. (I'm using Saxon.)I don't have any experience with Antenna House, but I use RenderX that has similar extensions.
Here's an example of an XML file, XSL stylesheet, and the resulting XSL-FO. (Which works fine in RenderX.)
XML File
XSL stylesheet
XSL-FO output
I think if you swap the renderx extensions (
rx:
) for the antenna house extensions, it should work. Maybe you should try rendering the XSL-FO first before trying to generate the XSL-FO using XSL-T.Hope this helps.
这是我的错。有一个我不知道的 xsd 架构文件。我们最终不得不在根节点和块节点中使用“任意”元素,以获得访问天线室扩展的模板。
This was my fault. There was an xsd schema file that I wasn't aware of. We ended up having to use the "any" element in the root and block nodes in order to get the template to access the antennahouse extentions.
focheck (https://github.com/AntennaHouse/focheck) 版本包括用于 XSL 1.1 的 W3C XSD 以及 Antenna House 扩展。
focheck (https://github.com/AntennaHouse/focheck) releases include a W3C XSD for XSL 1.1 plus Antenna House extensions.