Attribute Coercion with stylesheet - Institution Name

138 views
Skip to first unread message

Docjay

unread,
Apr 10, 2019, 4:47:46 PM4/10/19
to dcm...@googlegroups.com
DCM4CHEE V5.15.0

Hello all,

    Trying to coerce the Institution name (tag 0008,0080') by testing if the patient is a certain value and I cannot get the tags coerced.

Can someone look at my stylesheet and maybe tell me if I need to set the variable of "patName" to somehow select the FamilyName?  I've read over the wiki, but I don't see any examples that include Patient Name for what I'm looking to achieve here.

I want to test if the last name of the patient contains 'TEST-PROD' and if so, then replace the Issuer and the Institution Name according to my stylesheet below.

Thank you

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>
   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>
           
<xsl:variable name="patId" select="DicomAttribute[@tag='00100020']/Value"/>
           
<xsl:variable name="patName" select="DicomAttribute[@tag='00100010']/Value"/>
           
<xsl:variable name="StudyDesc" select="DicomAttribute[@tag='00081030']/Value"/>
           
<xsl:variable name="AccNum" select="DicomAttribute[@tag='00080050']/Value"/>
           
<xsl:variable name="Mod" select="DicomAttribute[@tag='00080061']/Value"/>
           
<xsl:variable name="instName" select="DicomAttribute[@tag='00080080']/Value"/>
           
<xsl:variable name="station" select="DicomAttribute[@tag='00081010']/Value"/>
           
<xsl:variable name="issuer" select="DicomAttribute[@tag='00100021']/Value"/>
           
           
<!-- TEST -->
           
<xsl:if test="contains($patName, 'TEST-PROD')"><!-- testing patient name here -->
               
<DicomAttribute tag="00100021" vr="LO">
                 
<Value number="1">HOSP1</Value>
               
</DicomAttribute>
               
<DicomAttribute tag="00080080" vr="LO">
                 
<Value number="1">HOSP1</Value>
               
</DicomAttribute>
           
</xsl:if>
       
</NativeDicomModel>
   
</xsl:template>
</xsl:stylesheet>


vrinda...@j4care.com

unread,
Apr 11, 2019, 4:45:54 AM4/11/19
to dcm4che
Use instead :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>
   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>
         ...........
         ...........
         <xsl:variable name="familyName" select="DicomAttribute[@tag='00100010']/PersonName[1]/Alphabetic/FamilyName"/>
         .........
         .........
        
         <xsl:if test="contains($familyName, 'TEST-PROD')"><!-- testing patient name here -->
          ........
          ........

         </xsl:if>
       
</NativeDicomModel>
   
</xsl:template>
</xsl:stylesheet>




Docjay

unread,
Apr 11, 2019, 9:13:03 AM4/11/19
to dcm4che

That worked great- thank you very much for the help!
Reply all
Reply to author
Forward
0 new messages