Note that variadic macros *can* be sued.
[metze/wireshark/wip.git] / fix / hfDecl.xsl
1 <!--
2 -->
3
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
5  <xsl:output method="text" encoding="UTF-8"/>
6
7  <xsl:template match="text()"/>
8
9  <xsl:template match="/">
10 static fix_field fix_fields[] = {
11 <xsl:apply-templates/>
12     };
13 </xsl:template>
14
15
16 <xsl:template match="fields">
17 <xsl:for-each select="field">
18     <xsl:sort select="@number" data-type="number"/>
19     <xsl:choose>
20            <xsl:when test="count( value ) != 0">
21               <xsl:variable name="val_type" >
22                   <xsl:choose>
23                        <xsl:when test="@type='INT'">0</xsl:when>
24                      <xsl:when test="@type='STRING'">1</xsl:when>
25                     <xsl:otherwise>2</xsl:otherwise>
26                   </xsl:choose>
27                 </xsl:variable>
28         { <xsl:value-of select="@number"/>, -1, <xsl:copy-of select="$val_type" />, <xsl:value-of select="@name"/>_val },</xsl:when>
29           <xsl:otherwise>
30         { <xsl:value-of select="@number"/>, -1, 0, NULL }, /* <xsl:value-of select="@name"/> */</xsl:otherwise>
31     </xsl:choose>
32 </xsl:for-each>
33 </xsl:template>
34 </xsl:stylesheet>