[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Generating barcode SVG-files

Subject: Generating barcode SVG-files
From: Asbjørn Reglund Thorsen <a.r.thorsen@xxxxxxxxxxx>
Date: Mon, 10 Apr 2006 13:31:57 +0200
asbj rn reglund thorsen
I have used RenderX's 2to5 interleave barcode generator.
My question is: How can I generate 222222.svg, 123456.svg and 019283.svg files (see my test-XML below) ? I probably need to make a recurcive template ?
I was told that I should use xsl:document. Is xsl:result-document better in any way ?


My test-XML:
---------------------------------
<?xml version="1.0"?>
<doc>
 <barcodes>
   <barcode value="222222" addchecksum="false"/>
   <barcode value="123456" addchecksum="false"/>
   <barcode value="019283" addchecksum="false"/>
 </barcodes>
</doc>

My test-XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import href="2of5i.xsl"/>
<xsl:output method="xml" indent="yes"/>


<xsl:template match="/">
<fo:root font-family="Times" font-size="10pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="barcodes-page">
<fo:region-body margin="0.5in" border="0.25pt solid silver" padding="10pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="barcodes-page">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="barcodes">
<xsl:for-each select="barcode">
<xsl:apply-templates select="." mode="draw"/>
</xsl:for-each>
</xsl:template>
<!-- This template call barcode generator to create SVG representation of 2-of-5 interleave barcode -->
<xsl:result-document href="mytestfile.svg"> <!-- this doesn't work but illustrates how lost I am --> <xsl:template match="barcode" mode="draw">
<fo:block>
<fo:instream-foreign-object content-width="20mm" content-height="20mm">
<xsl:call-template name="barcode-2of5i">
<xsl:with-param name="value" select="@value"/>
<xsl:with-param name="addchecksum" select="@addchecksum"/>
</xsl:call-template>
</fo:instream-foreign-object>
</fo:block>
</xsl:template>
</xsl:result-document>
</xsl:stylesheet>




--
Asbjxrn Thorsen

"HAKONA MATATA" ;-)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.