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-extensi开发者_开发百科on.htm#axf.document-info
Unfortunately it doesn't seem to be working with v4.3 of their xsl formatter.
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 in xsl: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
<?xml version="1.0" encoding="UTF-8"?>
<root/>
XSL stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:rx="http://www.renderx.com/XSL/Extensions">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/root">
<fo:root>
<rx:meta-info>
<rx:meta-field name="title" value="Some Title"/>
<rx:meta-field name="author" value="DevNull"/>
<rx:meta-field name="subject" value="Some Subject"/>
<rx:meta-field name="keywords" value="abc def ghi jkl"/>
</rx:meta-info>
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<fo:block/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
XSL-FO output
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:rx="http://www.renderx.com/XSL/Extensions">
<rx:meta-info>
<rx:meta-field name="title" value="Some Title"/>
<rx:meta-field name="author" value="DevNull"/>
<rx:meta-field name="subject" value="Some Subject"/>
<rx:meta-field name="keywords" value="abc def ghi jkl"/>
</rx:meta-info>
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<fo:block/>
</fo:flow>
</fo:page-sequence>
</fo:root>
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.
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.
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://www.antennahouse.com/names/XSL/Extensions" processContents="skip"/>
...
<xs:element name="block">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="http://www.antennahouse.com/names/XSL/Extensions" processContents="skip"/>
...
focheck (https://github.com/AntennaHouse/focheck) releases include a W3C XSD for XSL 1.1 plus Antenna House extensions.
精彩评论