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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:qct="http://www.quickcamteam.net"
>
<xsl:output method="text" />
<xsl:strip-space elements="qct:config qct:constants" />
<!-- Only process the root 'config' element -->
<xsl:template match="/">
<xsl:apply-templates select="qct:config/qct:meta" />
/* Start constants */
<xsl:apply-templates select="qct:config/qct:constants" />
/* End constants */
</xsl:template>
<xsl:template match="qct:meta">
/*
* UVC dynamic control mapping header file
*
* This file has been dynamically generated using the include.xsl XSLT
* transform stylesheet from a dynamic control mapping configuration file.
*<xsl:apply-templates select="qct:version|qct:author|qct:contact|qct:revision|qct:copyright" />
*/
</xsl:template>
<xsl:template match="qct:version">
* Version: <xsl:apply-templates />
</xsl:template>
<xsl:template match="qct:author">
* Author: <xsl:apply-templates />
</xsl:template>
<xsl:template match="qct:contact">
* Contact: <xsl:apply-templates />
</xsl:template>
<xsl:template match="qct:revision">
* Revision: <xsl:apply-templates />
</xsl:template>
<xsl:template match="qct:copyright">
*
* <xsl:apply-templates />
</xsl:template>
<xsl:template match="qct:config">
<xsl:apply-templates select="qct:constants" />
</xsl:template>
<xsl:template match="qct:constants">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="qct:constant">
#ifndef <xsl:value-of select="qct:id" />
<xsl:choose space="preserve">
<!-- Integer type constant -->
<xsl:when test="@type='integer'">
#define <xsl:value-of select="qct:id" /><xsl:text> </xsl:text><xsl:value-of select="qct:value" />
</xsl:when>
<!-- GUID type constant -->
<xsl:when test="@type='guid'">
#define <xsl:value-of select="qct:id" /> { \
0x<xsl:value-of select="substring(qct:value,7,2)" />, 0x<xsl:value-of select="substring(qct:value,5,2)" />, 0x<xsl:value-of select="substring(qct:value,3,2)" />, 0x<xsl:value-of select="substring(qct:value,1,2)" />, 0x<xsl:value-of select="substring(qct:value,12,2)" />, 0x<xsl:value-of select="substring(qct:value,10,2)" />, 0x<xsl:value-of select="substring(qct:value,17,2)" />, 0x<xsl:value-of select="substring(qct:value,15,2)" />, \
0x<xsl:value-of select="substring(qct:value,20,2)" />, 0x<xsl:value-of select="substring(qct:value,22,2)" />, 0x<xsl:value-of select="substring(qct:value,25,2)" />, 0x<xsl:value-of select="substring(qct:value,27,2)" />, 0x<xsl:value-of select="substring(qct:value,29,2)" />, 0x<xsl:value-of select="substring(qct:value,31,2)" />, 0x<xsl:value-of select="substring(qct:value,33,2)" />, 0x<xsl:value-of select="substring(qct:value,35,2)" /> \
}
</xsl:when>
<!-- Unknown constant type -->
<xsl:otherwise>
/* Unknown constant type '<xsl:value-of select="@type" />' encountered */
/* #define <xsl:value-of select="qct:id" /><xsl:text> </xsl:text><xsl:value-of select="qct:value" /> */
</xsl:otherwise>
</xsl:choose>
#endif
</xsl:template>
</xsl:transform>
|