-1

Here is the XML:

    <recordTarget>
        <patientRole>
          <patient>
           <religiousAffiliationCode code="1013" displayName="Christian (non-Catholic, non-specific)" codeSystem="2.16.840.1.113883.5.1076" codeSystemName="HL7 Religious Affiliation"/>
   </patient>
</patientRole>
</recordTarget>

Here is my xpath statement (n1 is namespace)

<xsl:variable name="religion" select="n1:recordTarget/n1:patientRole/n1:patient/n1:religiousAffilliationCode/@displayName"/>
kjhughes
  • 106,133
  • 27
  • 181
  • 240
B Hale
  • 1

2 Answers2

0

The result of evaluating your XPath against your XML depends upon factors you've not told us.

It is dependent upon

  • the current context since it is a relative XPath.
  • the definition of the n1 namespace prefix being consistently defined in the XML and in the language hosting the XPath. See How does XPath deal with XML namespaces?
  • the namespace of recordTarget, patientRole, etc, which cannot be determined without seeing their full heritage.
Community
  • 1
  • 1
kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • I only included a small amount of the XML, but current context is correct, namespace n1 is defined. Michael Kay has a sharp eye. It is a spelling error. – B Hale Mar 12 '17 at 16:27
0

Check the spelling of religiousAffiliationCode.

(Incidentally, the only real defence against spelling mistakes in path expressions is to use the schema-awareness features in XSLT 2.0, which if you take advantage of them correctly give you compile-time checking that the paths make sense with respect to the schema. This is particularly relevant when using a vocabulary like HL7 where the names tend to be long and tortuous.)

Michael Kay
  • 156,231
  • 11
  • 92
  • 164