Altova StyleVision 2024 Enterprise Edition

The XSLT Engine uses third-party Java libraries to create barcodes. Given below are the classes and the public methods used. The classes are packaged in AltovaBarcodeExtension.jar, which is located in the folder <ProgramFilesFolder>\Altova\Common2024\jar.


The Java libraries used are in sub-folders of the folder <ProgramFilesFolder>\Altova\Common2024\jar:


barcode4j\barcode4j.jar  (Website:

zxing\core.jar  (Website:


The license files are also located in the respective folders.


Java virtual machine

In order to be able to use the barcode functions, a Java virtual machine must be available on your machine and it must match the bit version of the Altova application (32-bit or 64-bit). The path to the machine is found as noted below.


If you are using an Altova desktop product, the Altova application attempts to detect the path to the Java virtual machine automatically, by reading (in this order): (i) the Windows registry, and (ii) the JAVA_HOME environment variable. You can also add a custom path in the Options dialog of the application; this entry will take priority over any other Java VM path detected automatically.

If you are running an Altova server product on a Windows machine, the path to the Java virtual machine will be read first from the Windows registry; if this is not successful the JAVA_HOME environment variable will be used.

If you are running an Altova server product on a Linux or macOS machine, then make sure that the JAVA_HOME environment variable is properly set and that the Java Virtual Machines library (on Windows, the jvm.dll file) can be located in either the \bin\server or \bin\client directory.


XSLT example to generate barcode

Given below is an XSLT example showing how barcode functions are used in an XSLT stylesheet.


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="2.0" xmlns:xsl="" 

   <xsl:output method="html" encoding="UTF-8" indent="yes"/>

   <xsl:template match="/">




            <img alt="barcode" src="data:image/png;base64"/>



         method="text" encoding="base64tobinary" >

         <xsl:variable name="barcodeObject" 
            select="altovaext-barcode:newInstance('Code39',string('some value'), 
            96,0, (altovaext-barcode-property:new( 'setModuleWidth', 25.4 div 96 * 2 ) ) )"/>

         <xsl:value-of select="xs:base64Binary(xs:hexBinary(string(altovaext-barcode:generateBarcodePngAsHexString($barcodeObject)) ))"/>





XQuery example to generate QR code

Given below is an XQuery example showing how barcode functions can be used to generate a QR code image.


declare variable $lines := unparsed-text-lines('', 'utf-8');

declare variable $main := map:merge(tokenize(head($lines), ';')!map{.:position()});

declare variable $data := map:merge(tail($lines)!array{tokenize(., ';')}!map{?($main?Name): [?($main?Date), xs:integer(?($main?ConfirmedCasesProvinces)) - xs:integer(?($main?Recovered))]}, map{'duplicates':'combine'});

declare variable $chart_img := altovaext:chart(map{'width': 1900, 'height': 600}, map:for-each($data, function($k, $v){[$k, $v?1!substring-before(., 'T'), $v?2][$k != 'Austria']}));

<img src="data:image/png;base64,{$chart_img}"/>

(:$main,  $data,:)



The com.altova.extensions.barcode package

The package, com.altova.extensions.barcode, is used to generate most of the barcode types.


The following classes are used:


public class BarcodeWrapper

 static BarcodeWrapper newInstance( String name, String msg, int dpi, int orientation, BarcodePropertyWrapper[] arrProperties )

 double getHeightPlusQuiet()

 double getWidthPlusQuiet()

 org.w3c.dom.Document generateBarcodeSVG()

 byte[] generateBarcodePNG()

 String generateBarcodePngAsHexString()


public class BarcodePropertyWrapper Used to store the barcode properties that will be dynamically set later

 BarcodePropertyWrapper( String methodName, String propertyValue )

 BarcodePropertyWrapper( String methodName, Integer propertyValue )

 BarcodePropertyWrapper( String methodName, Double propertyValue )

 BarcodePropertyWrapper( String methodName, Boolean propertyValue )

 BarcodePropertyWrapper( String methodName, Character propertyValue )

 String getMethodName()

 Object getPropertyValue()


public class AltovaBarcodeClassResolver Registers the class com.altova.extensions.barcode.proxy.zxing.QRCodeBean for the qrcode bean, additionally to the classes registered by the org.krysalis.barcode4j.DefaultBarcodeClassResolver.



The com.altova.extensions.barcode.proxy.zxing package

The package, com.altova.extensions.barcode.proxy.zxing, is used to generate the QRCode barcode type.


The following classes are used:


class QRCodeBean


Extends org.krysalis.barcode4j.impl.AbstractBarcodeBean

Creates an AbstractBarcodeBean interface for  


 void generateBarcode(CanvasProvider canvasImp, String msg)

 void setQRErrorCorrectionLevel(QRCodeErrorCorrectionLevel level)

 BarcodeDimension calcDimensions(String msg)

 double getVerticalQuietZone()

 double getBarWidth()


class QRCodeErrorCorrectionLevel Error correction level for the QRCode

 static QRCodeErrorCorrectionLevel byName(String name)

 “L” = ~7% correction

 “M” = ~15% correction

 “H” = ~25% correction

 “Q” = ~30% correction


© 2018-2024 Altova GmbH