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 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="yes"/>
<!-- XSL to convert XML Part6.xml UIDs into C++ code -->
<!--
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
-->
<xsl:template match="/dicts">
<xsl:text>
// GENERATED FILE DO NOT EDIT
// $ xsltproc UIDToC++.xsl Part6.xml > gdcmUIDs.cxx
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
</xsl:text>
<xsl:text>
#ifndef GDCMUIDS_H
#define GDCMUIDS_H
typedef enum {
</xsl:text>
<xsl:for-each select="table/uid">
<xsl:choose>
<xsl:when test="../@name = 'UID VALUES'">
<xsl:text>uid_</xsl:text>
</xsl:when>
<xsl:when test="../@name = 'Well-known Frames of Reference'">
<xsl:text>frameref_</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>unhandled_</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="translate(@value,'.','_')"/>
<xsl:text> = </xsl:text>
<xsl:number value="position()" format="1" />
<xsl:text>, // </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:text>
} TSType;
typedef enum {
</xsl:text>
<xsl:for-each select="table/uid">
<!--xsl:choose>
<xsl:when test="../@name = 'UID VALUES'">
<xsl:text>uid_</xsl:text>
</xsl:when>
<xsl:when test="../@name = 'Well-known Frames of Reference'">
<xsl:text>frameref_</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>unhandled_</xsl:text>
</xsl:otherwise>
</xsl:choose-->
<xsl:if test="starts-with(@name,'1')">
<xsl:text>//</xsl:text>
</xsl:if>
<xsl:value-of select="translate(@name,'&@[]/(),-: ','')"/>
<xsl:if test="@retired = 'true'">
<xsl:text>Retired</xsl:text>
</xsl:if>
<xsl:text> = </xsl:text>
<xsl:number value="position()" format="1" />
<xsl:text>, // </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:text>} TSName;
#endif // GDCMUIDS_H
</xsl:text>
#ifdef GDCMUIDS_CXX
<xsl:text>static const char * const TransferSyntaxStrings[][2] = {
</xsl:text>
<xsl:for-each select="table/uid">
<xsl:text>{"</xsl:text>
<xsl:value-of select="@value"/>
<xsl:text>","</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>"},
</xsl:text>
</xsl:for-each>
<xsl:text>{ 0, 0 }
};
#endif // GDCMUIDS_CXX
</xsl:text>
</xsl:template>
</xsl:stylesheet>
|