%PDF- %PDF-
Direktori : /data/bordel/scanned/ |
Current File : //data/bordel/scanned/transform.xsl |
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="ConvertDecToHex"> <xsl:param name="value" /> <xsl:param name="len" select="0" /> <xsl:choose> <xsl:when test="$value >0"> <xsl:call-template name="ConvertDecToHex"> <xsl:with-param name="value" select="floor($value div 16)" /> <xsl:with-param name="len" select="$len + 1" /> </xsl:call-template> <xsl:choose> <xsl:when test="$value mod 16 < 10"> <xsl:value-of select="$value mod 16" /> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$value mod 16 = 10">A</xsl:when> <xsl:when test="$value mod 16 = 11">B</xsl:when> <xsl:when test="$value mod 16 = 12">C</xsl:when> <xsl:when test="$value mod 16 = 13">D</xsl:when> <xsl:when test="$value mod 16 = 14">E</xsl:when> <xsl:when test="$value mod 16 = 15">F</xsl:when> <xsl:otherwise>A</xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:if test="$len < 8">0<xsl:call-template name="ConvertDecToHex"> <xsl:with-param name="value" select="0" /> <xsl:with-param name="len" select="$len + 1" /> </xsl:call-template> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//value"> <xsl:call-template name="ConvertDecToHex"> <xsl:with-param name="value"> <xsl:value-of select="."/> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template match="/"> <output> <xsl:for-each select="source/row"> <radek> <jmeno> <xsl:value-of select="name"/> </jmeno> <hodnota> <xsl:value-of select="value"/> <!-- <xsl:call-template name="ConvertDecToHex"> <xsl:with-param name="value"> <xsl:value-of select="value"/> </xsl:with-param> </xsl:call-template> --> </hodnota> </radek> </xsl:for-each> </output> <xsl:apply-templates /> </xsl:template> </xsl:stylesheet>