XSLT to generate QR codes from an XML

I need to have a XSLT to generate QR codes from an XML.

The XML should be something like:

<qrcode code=“http://exemple.com” errorlvl="L" encoding="UTF-8"/>

It needs to be paramatrable for every error levels and to be encoded in UTF-8 and ISO-8859–1.

Thé image generate should be an svg.

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

<xsl:stylesheet

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:svg="http://www.w3.org/2000/svg"

xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns="http://www.w3.org/2000/svg"

xmlns:charsets="charsets:charsets"

exclude-result-prefixes="charsets"

xmlns:date="http://exslt.org/dates-and-times"

extension-element-prefixes="date"

version="1.0">

<xsl:output

method="xml"

omit-xml-declaration="yes"

media-type="text/svg"

indent="no"

encoding="UTF-8"/>

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

<?xml-stylesheet type="text/xsl" href="barcode.xslt"?>

<barcodes>

<barcode description="TAB.0001" below="SM-T580 001"/>

<barcode description="TAB.0002" below="SM-T580 002"/>

<barcode description="TAB.0003" below="SM-T580 003"/>

<barcode description="TAB.0004" below="SM-T580 004"/>

<barcode description="TAB.0005" below="SM-T580 005"/>

<barcode description="TAB.0006" below="SM-T580 006"/>

<barcode description="TAB.0007" below="SM-T580 007"/>

<barcode description="TAB.0008" below="SM-T580 008"/>

<barcode description="TAB.0009" below="SM-T580 009"/>

<barcode description="TAB.0010" below="SM-T580 010"/>

<barcode description="TAB.0011" below="SM-T580 011"/>

<barcode description="TAB.0012" below="SM-T580 012"/>

<barcode description="TAB.0013" below="SM-T580 013"/>

<barcode description="TAB.0014" below="SM-T580 014"/>

<barcode description="TAB.0015" below="SM-T580 015"/>

<barcode description="TAB.0016" below="SM-T580 016"/>

<barcode description="TAB.0017" below="SM-T580 017"/>

<barcode description="TAB.0018" below="SM-T580 018"/>

<barcode description="TAB.0019" below="SM-T580 019"/>

<barcode description="TAB.0020" below="SM-T580 020"/>

<barcode description="SJK.0001" below="sohrabjk"/>

</barcodes>

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

<xsl:stylesheet

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:loc="loc:loc" exclude-result-prefixes="loc"

version="1.0">

<xsl:decimal-format name="swiss" decimal-separator="." grouping-separator=" " />

<xsl:output method="html" omit-xml-declaration="yes"/>

<!-- Version -->

<xsl:variable name="xslver" select='1' />

<xsl:param name="grouped" select="'0'"/>

<xsl:include href="code128.xslt"/>

<xsl:template match="/">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta charset="UTF-8"/>

</style>

</head>

<body class="no-debug">

<xsl:for-each select="/barcodes/barcode">

<div class="page" size="62x25">

<div id="sequence"><xsl:value-of select="position()"/></div>

<div id="barcode-plain" class="large"><xsl:value-of select="@description"/></div>

<xsl:call-template name="svg-128">

<xsl:with-param name="input" select="@description"/>

<xsl:with-param name="module-width" select="1.5"/>

<xsl:with-param name="module-height" select="25"/>

<xsl:with-param name="charset" select="'B'"/>

<xsl:with-param name="unit" select="''"/>

</xsl:call-template>

<div id="description" class="large"><xsl:value-of select="@below"/></div>

</div>

</xsl:for-each>

</body>

<script type="text/javascript" language="javascript">

var container = document.defaultView.frameElement;

var html = document.querySelector("html");

if(container) {

DOMTokenList.prototype.add.apply(html.classList, container.className.split(/\s/));

}

</script>

</html>

</xsl:template>

</xsl:stylesheet>

Answer Detail

Get This Answer

Invite Tutor