Last active
August 29, 2015 14:08
-
-
Save fdlk/b52ef3af3b150a55314e to your computer and use it in GitHub Desktop.
Parse DICOM tags table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:db="http://docbook.org/ns/docbook" | |
xmlns:fn="http://www.w3.org/2005/xpath-functions"> | |
<xsl:output method="text" encoding="UTF-8" indent="no" /> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="//db:table[@label='6-1']/db:tbody"/> | |
</xsl:template> | |
<xsl:template match="//db:tr"><xsl:apply-templates/><xsl:text> | |
</xsl:text> | |
</xsl:template> | |
<xsl:template match="db:td[0]/db:para"><xsl:value-of select="text()"/><xsl:text> </xsl:text></xsl:template> | |
<xsl:template match="db:td[1]/db:para"> | |
<xsl:if test="text()"><xsl:value-of select="fn:replace(text(),'\(([0-9A-Fx]{4}),([0-9A-F]{4})\)','dcm_ATT$1$2')"/><xsl:text> </xsl:text></xsl:if> | |
</xsl:template> | |
<xsl:template match="db:td[2]/db:para"><xsl:value-of select="text()"/><xsl:text> </xsl:text></xsl:template> | |
<xsl:template match="db:td[3]/db:para"><xsl:value-of select="fn:replace(text(),'','')"/><!-- removes invis spaces --><xsl:text> </xsl:text></xsl:template> | |
<xsl:template match="db:td[4]/db:para"> | |
<xsl:if test="text()='AE'">string</xsl:if> | |
<xsl:if test="text()='AS'">string</xsl:if> | |
<xsl:if test="text()='AT'">mref</xsl:if> | |
<xsl:if test="text()='CS'">string</xsl:if> | |
<xsl:if test="text()='DA'">date</xsl:if> | |
<xsl:if test="text()='DS'">decimal</xsl:if> | |
<xsl:if test="text()='DT'">datetime</xsl:if> | |
<xsl:if test="text()='FL'">decimal</xsl:if> | |
<xsl:if test="text()='FD'">decimal</xsl:if> | |
<xsl:if test="text()='IS'">int</xsl:if> | |
<xsl:if test="text()='LO'">string</xsl:if> | |
<xsl:if test="text()='LT'">text</xsl:if> | |
<xsl:if test="text()='OB'">file</xsl:if> | |
<xsl:if test="text()='OD'">file</xsl:if> | |
<xsl:if test="text()='OF'">file</xsl:if> | |
<xsl:if test="text()='OW'">file</xsl:if> | |
<xsl:if test="text()='PN'">string</xsl:if> | |
<xsl:if test="text()='SH'">string</xsl:if> | |
<xsl:if test="text()='SL'">decimal</xsl:if> | |
<xsl:if test="text()='SQ'">mref</xsl:if> | |
<xsl:if test="text()='SS'">decimal</xsl:if> | |
<xsl:if test="text()='ST'">text</xsl:if> | |
<xsl:if test="text()='TM'">datetime</xsl:if> | |
<xsl:if test="text()='UI'">string</xsl:if> | |
<xsl:if test="text()='UL'">long</xsl:if> | |
<xsl:if test="text()='UN'">file</xsl:if> | |
<xsl:if test="text()='UR'">hyperlink</xsl:if> | |
<xsl:if test="text()='US'">int</xsl:if> | |
<xsl:if test="text()='UT'">text</xsl:if> | |
</xsl:template> | |
<xsl:template match="db:td[5]"></xsl:template> | |
<xsl:template match="db:td[6]"></xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment