1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
<xsl:template match="/">Src,Port,Dst,Port,Message,Name,Transport Protocol
<xsl:for-each select="archive/list/map">
<xsl:for-each select="values/list">
<xsl:apply-templates select="string | null"/>
</xsl:for-each>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
<xsl:template match="string">
<xsl:variable name="position" select="position()"></xsl:variable>
<xsl:choose>
<xsl:when test="$position=2 or $position=4">
<xsl:call-template name='math:cvt-hex-decimal'>
<xsl:with-param name='value' select="."/>
</xsl:call-template>,</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>,</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="null">
<xsl:text>,</xsl:text></xsl:template>
<xsl:template name="math:cvt-hex-decimal">
<xsl:param name="value"/>
<xsl:choose>
<xsl:when test='$value = ""'/>
<xsl:when test='string-length($value) = 1'>
<xsl:call-template name='math:cvt-hex-decimal-digit'>
<xsl:with-param name='digit' select='$value'/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:variable name='last-digit'>
<xsl:call-template name='math:cvt-hex-decimal-digit'>
<xsl:with-param name='digit' select='substring($value,string-length($value),1)'/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name='remainder'>
<xsl:call-template name='math:cvt-hex-decimal'>
<xsl:with-param name='value' select='substring($value,1,string-length($value)-1)'/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select='$last-digit + $remainder * 16'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name='math:cvt-hex-decimal-digit'>
<xsl:param name='digit' select='0'/>
<xsl:choose>
<xsl:when test='$digit <= 9'>
<xsl:value-of select='$digit'/>
</xsl:when>
<xsl:when test='$digit = "a" or $digit = "A"'>10</xsl:when>
<xsl:when test='$digit = "b" or $digit = "B"'>11</xsl:when>
<xsl:when test='$digit = "c" or $digit = "C"'>12</xsl:when>
<xsl:when test='$digit = "d" or $digit = "D"'>13</xsl:when>
<xsl:when test='$digit = "e" or $digit = "E"'>14</xsl:when>
<xsl:when test='$digit = "f" or $digit = "F"'>15</xsl:when>
</xsl:choose>
</xsl:template> |
Partager