Hello everyone,
I am new to xsl.
I have to display both an image and a barcode on a
pdf file using xsl-fo.
I am pasting the code of the xsl file below the body of this mail.
When I remove the block code related to the image from xsl file,
I am able to display the barcode alone on pdf.
Similarly, when I remove the code related to the barcode generation,
I am able to display the image alone on pdf.
However, if I don't remove any code and use the below xsl for displaying both
image and barcode,
I get a pop-up saying "Some files may harm your computer. If teh file
information looks suspicious,
or you fully do not trust the source, do not open or save this file" I clicked
on Open
button and I get a message that "Internet explorer cannot download from
localhost".
Kindly, let me know on how to ressolve this problem.
Thanks and regards,
Jagan
<xsl:stylesheet version="1.1" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"
xmlns:fo=" http://www.w3.org/1999/XSL/Format"
xmlns:barcode="org.krysalis.barcode.xalan.BarcodeExt" xmlns:common="
http://exslt.org/common" xmlns:xalan=" http://xml.apache.org"
exclude-result-prefixes="barcode common xalan">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes"/>
<!-- variable holding Copyright text for the footer -->
<xsl:template match="Bundle">
<xsl:apply-templates select="bundleName"/>
</xsl:template>
<xsl:template match="Bundle">
<fo:root xmlns:fo=" http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="59.7cm"
page-width="31cm"
margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block space-after="75mm">
<fo:external-graphic src="testImage.bmp" />
</fo:block>
<fo:block font-size="16pt" font-weight="bold" space-after="5mm">Bundle
Information
</fo:block>
<fo:block font-size="10pt">
<xsl:value-of select="bundleName"/>
</fo:block>
<xsl:variable name="barcode-cfg">
<barcode>
<upc-a/>
</barcode>
</xsl:variable>
<fo:block space-after="75mm">
<fo:instream-foreign-object>
<xsl:copy-of select="barcode:generate($barcode-cfg, '71078710112')"/>
</fo:instream-foreign-object>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>