Closed bing-10 closed 2 years ago
To make it sure, could you attach your com.test.pdf ZIP archve?
Ok, here is the ZIP archive: com.test.pdf.zip
I could reproduce the problem. May be a bug. Please give me to analyze the cause.
transform.merged.common.jaxp:
[echo] Stylesheet=D:\DITA-OT\dita-ot-3.7.1\plugins\com.test.pdf\xsl\dita2fo_shell.xsl
[echo] use.i18n.index.lib=no
[echo] user.input.dir=D:\My_Documents\XML2022\support\PDF5
[xslt] Processing D:\My_Documents\XML2022\support\PDF5\temp\pdf5.ml\PDF5-ML-Custmization-Test_CONVERTED.xml to D:\My_Documents\XML2022\support\PDF5\temp\pdf5.ml\PDF5-ML-Custmization-Test_psmi.fo
[xslt] Loading stylesheet D:\DITA-OT\dita-ot-3.7.1\plugins\com.test.pdf\xsl\dita2fo_shell.xsl
[xslt] Building tree for file:/D:/My_Documents/XML2022/support/PDF5/temp/pdf5.ml/PDF5-ML-Custmization-Test_CONVERTED.xml using class net.sf.saxon.tree.tiny.TinyBuilder
[xslt] Tree built in 2.8919ms
[xslt] Tree size: 34 nodes, 71 characters, 47 attributes
[xslt] Antenna House PDF5-ML plug-in Version: 1.0.8
[xslt] Running on: SAXON (http://www.saxonica.com/) Version: HE 10.6
[xslt] Building tree for file:/D:/DITA-OT/dita-ot-3.7.1/plugins/com.test.pdf/config/en-US_style.xml using class net.sf.saxon.tree.tiny.TinyBuilder
[xslt] Tree built in 0.2736ms
[xslt] Tree size: 7 nodes, 0 characters, 1 attributes
[xslt] Building tree for file:/D:/DITA-OT/dita-ot-3.7.1/plugins/com.test.pdf/config/default_style.xml using class net.sf.saxon.tree.tiny.TinyBuilder
[xslt] Building tree for (unknown systemId) using class net.sf.saxon.tree.tiny.TinyBuilder
[xslt] Tree built in 0.1015ms
[xslt] Tree size: 4 nodes, 137 characters, 0 attributes
[xslt] [ERROR][styledef 104F] Style definition file file:/D:/DITA-OT/dita-ot-3.7.1/plugins/com.test.pdf/config/default_style.xml does not found.
[xslt] D:\DITA-OT\dita-ot-3.7.1\plugins\com.antennahouse.pdf5.ml\xsl\dita2fo_error_util.xsl:43:81: Fatal Error! Processing terminated by xsl:message at line 43 in dita2fo_error_util.xsl
[xslt] Failed to process D:\My_Documents\XML2022\support\PDF5\temp\pdf5.ml\PDF5-ML-Custmization-Test_CONVERTED.xml
You didn't close the variable tag:
<variable name="companyLogo">%plug-in-path%common-graphic/my-logo.svg<variable>
This is the cause.
Oh... It's due to my carelessness. Sorry for the unnecessary trouble.
It can run normally now, but the targeted logo image did not appear on the cover page. Is there any other requirement except for these?
<xsl:template name="putLogo">
<xsl:variable name="companyLogoPath" as="xs:string" select="ahf:getVarValue('companyLogo')"/>
<fo:block>
<fo:external-graphic src="{$companyLogoPath}"/>
</fo:block>
</xsl:template>
"putLogo" template should be called somewhere in "genCover" template. So you should override "genCover" template in your plug-in.
I have searched in the xsl files in both com.antennahouse.pdf5.ml and com.test.pdf plugin, but there is no such template, maybe it has been renamed? Or it is included in other template?
As noted above, copy com.antennahouse.pdf5.ml/xsl/dita2fo_cover.xsl
to your plug-in xsl
folder and include it in com.test.pdf/xsl/dita2fo_import.xsl
.
<xsl:include href="dita2fo_cover.xsl"/>
Then modify dita2fo_cover.xsl
to include the template call of "putLogo" in somewhere.
<xsl:call-template name="putLogo"/>
Then the logo will appear (somewhere) in the cover page.
Ok. Thank you. Now I can see the logo in the output, but how can I modify the logo image? (such as change the position, width, radius or not...)
Use fo:block-container with absolute position.
Position: fo:block-container/@absolute-position="absolute", @top, @left, etc Width: fo:extarnal-graphic/@content-width,@content-height Border: fo:block-container(fo:block)/@border, @axf:border-radius
I created two attribute-set atsLogoImage atsLogoImageBlock in default_style.xml:
<attribute-set name="atsLogoImage">
<attribute name="scaling">uniform</attribute>
<attribute name="content-width">20mm</attribute>
</attribute-set>
<attribute-set name="atsLogoImageBlock">
<attribute name="absolute-position">position</attribute>
<attribute name="content-width">auto</attribute>
<attribute name="content-height">auto</attribute>
<attribute name="top">0</attribute>
<attribute name="right">0</attribute>
<attribute name="margin">0</attribute>
<attribute name="padding">0</attribute>
</attribute-set>
and used these attribute-sets in the template "putLogo" in the custom xsl file:
<xsl:template name="putLogo">
<xsl:variable name="companyLogoPath" as="xs:string" select="ahf:getVarValue('companyLogo')"/>
<fo:block-container>
<xsl:copy-of select="ahf:getAttributeSet('atsLogoImageBlock')"/>
<fo:block>
<fo:external-graphic src="{$companyLogoPath}">
<xsl:copy-of select="ahf:getAttributeSet('atsLogoImage')"/>
</fo:external-graphic>
</fo:block>
</fo:block-container>
</xsl:template>
The output shows that I can just change the size of the logo, but the position has not be changed. Is it because I put
<xsl:copy-of select="ahf:getAttributeSet('atsLogoImageBlock')"/>
in wrong place?
You can change @aboslute-position property such like this:
<attribute name="absolute-position">absolute</attribute>
7.6.1 "absolute-position https://www.w3.org/TR/xsl11/#absolute-position"
Yes, I did this as the instructions suggest. I found that I wrongly typed position instead of absolute to assign the value. Now it works. Thank you!
According to the user manual of this plugin — pdf5.ml_manual.pdf, I made my own plug-in com.test.pdf. I added the logo svg file named my-logo.svg in com.test.pdf/common-graphic folder. Then I added the variable companyLogo in com.test.pdf/config/default_style.xml:
<variable name="companyLogo">%plug-in-path%common-graphic/my-logo.svg<variable>
and added these lines in com.test.pdf/xsl/dita2fo_custom.xsl:However, it failed to run, and the fatal error occured:
Could you give me some advice to solve this problem, please?