Subject: IF Statements with OID
Posted By: Navy1991_1 Post Date: 6/3/2008 8:45:01 AM
If an OID address is used is there something that needs to be done in the statement to accept the decimal points in the #?  The following is an example of this.  I am only getting a return of one value.

<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component">
<xsl:sort select="./n1:section/n1:effectiveTime/n1:low/@value"/>
<xsl:if test="./n1:section/n1:templateId/@root='2.16.840.1.113883.10.20.1.8'">
<td width='10%' align='left' valign="top">
<xsl:value-of select="./n1:section/n1:entry/n1:substanceAdministration/n1:effectiveTime/n1:period/@value"/><xsl:value-of select="./n1:entry/n1:substanceAdministration/n1:effectiveTime/n1:period/@unit"/>
</td>
</xsl:if>
</xsl:for-each>

Thanks!

Reply By: mhkay Reply Date: 6/3/2008 9:07:00 AM
Please give some context: what's in your source document, what do you mean by an OID (you can't assume there is only one meaning for an abbreviation like this), what output do you want, what output are you getting, what XSLT version are you using.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply By: samjudson Reply Date: 6/3/2008 10:52:20 AM
I think you mean this:

<xsl:if test="./n1:section/n1:templateId[@root='2.16.840.1.113883.10.20.1.8']">

/- Sam Judson : Wrox Technical Editor -/
Reply By: Navy1991_1 Reply Date: 6/3/2008 11:26:48 AM
My apologizes.  Thank you for the reply.  

xsl:stylesheet version="1.0"
xml version="1.0"

The OID is an object identifier to identify a section within an XML healthcare document.  This specific root OID is a Healthcare OID that specifies a patient's "Problem List".  There are multiple OIDs listed throughout the XML document that could reference different items within the document.   

I am wanting the XSLT to go through the XML document find this specific OID and return all selected values listed under the OID.

XML data (Portion of the data)
<component>
        <section>
          <!-- CCD Problem Section Template -->
          <templateId root="2.16.840.1.113883.10.20.1.11" />
          <code code="11450-4" displayName="Problem list" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" />
          <title>Problems</title>
          <text />
          <!--Each "entry" contains one problem observation-->
          <entry typeCode="DRIV">
            <!--Condition Module-->
            <act classCode="ACT" moodCode="EVN">
              <!--TemplateId 20.1.27 = CCD Problem Act 11.32.7 = C32 Condition Module-->
              <templateId root="2.16.840.1.113883.10.20.1.27" />
              <templateId root="2.16.840.1.113883.3.88.11.32.7." />
              <id root="ec8a6ff8-ed4b-4f7e-82c3-e98e58b45de7" />
              <code nullFlavor="NA" />
              <entryRelationship typeCode="SUBJ">
                <observation classCode="OBS" moodCode="EVN">
                  <!-- Problem observation template -->
                  <templateId root="2.16.840.1.113883.10.20.1.28" />
                  <id root="ab1791b0-5c71-11db-b0de-0800200c9a66" />
                  <!--Problem Date-->
                  <effectiveTime>
                    <low value="20070509" />
                  </effectiveTime>
                  <!--Problem Type-->
                  <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" />
                  <statusCode code="completed" />
                  <text>
                    <reference value="#prob1" />
                  </text>
                  <!--Problem Code (and description)-->
                  <value xsi:type="CD" code="251166008" displayName="AV Nodal Reentry Tachycardia" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
                  <!--Problem Status-->
                  <entryRelationship typeCode="REFR">
                    <observation classCode="OBS" moodCode="EVN">
                      <!--20.1.50 = problem status observation 20.1.57 = conformant status observation-->
                      <templateId root="2.16.840.1.113883.10.20.1.50"></templateId>
                      <templateId root="2.16.840.1.113883.10.20.1.57" />
                      <code code="33999-4" displayName="Status" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" />
                      <statusCode code="completed" />
                      <!--Problem Status-->
                      <value xsi:type="CE" code="413322009" displayName="Resolved" codeSystem="2.16.840.1.113883.1.11.20.13" codeSystemName="ProblemStatusCode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
                    </observation>
                  </entryRelationship>
                </observation>
              </entryRelationship>
            </act>

Reply By: mhkay Reply Date: 6/3/2008 12:08:31 PM
I can't see anything immediately wrong with your code. Your expression

<xsl:if test="./n1:section/n1:templateId/@root='2.16.840.1.113883.10.20.1.8'">

is equivalent to Sam's

test="./n1:section/n1:templateId[@root='2.16.840.1.113883.10.20.1.8']">

When you're dealing with a schema as complex as these healthcare vocabularies, there can be a lot of benefit in the XSLT 2.0 feature of writing schema-aware stylesheets. If you get into the habit of using schema-aware types in your match patterns and variable declarations, a lot of coding mistakes will be reported at compile time that otherwise take hours of run-time debugging.


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 71853

Return to index page 1