Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xpath attribute and namespaces

Status
Not open for further replies.

Xerus

Programmer
Jan 30, 2007
6
US
I have an HL7 xml document that uses the namespace xmlns:hl7="urn:hl7-org:v3" (this is a standardized XSD used in the healthcare industry) and also uses a name space for a vendor xmlns:vn=" I have no problem accessing the elements of the xml document in the hl7 namespace but can't seem to access any of the data contained in the vendor namespace.

all of the data in the vendor elements are in the following format:

<vendorData>
<myData key="name" value="Bob"/>
</vendorData>

I use the following to access the hl7 data:
<xsl:value-of select="hl7:ClinicalDocument/hl7:recordTarget/hl7:patientRole/hl7:patientPatient/hl7:name/hl7:family"/>

and I'm using the following to access the vendor data:
<xsl:value-of select="vn:vendorData/vn:myData[@key='name']/@value" />

I get nothing for the vendor data in the second namespace. I'm new to xml/xpath/xslt. how do I access the data in the vendor namespace? I'm using XMLSpy and it does not indicate that my xpath is invalid.
SS

----------
Sam

"Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest."

- Isaac Asimov
 
Answered my own question:

I had to clarify the vendor xpath with the main element of the hl7 xpath like so:

hl7:ClinicalDocument/vn:vendorData/vn:myData .....

SS

----------
Sam

"Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest."

- Isaac Asimov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top