Hello.
I have an XML file with the following <PRESCRIBINGPROVIDER> tag that occurs
within each <DETAILLINE>. I need to find the first occurrence of the
<PRESCRIBINGPROVIDER><FULLNAME> along with it's matching <NATIONALPROVIDERID>.
The problem is that for example, the first occurrence of <PRESCRIBINGPROVIDER> may have a value but it's <NATIONALPROVIDERID> may be blank.
The second occurrence may have a value for both tags.
It's OK to pick up the first occurrence of <PRESCRIBINGPROVIDER> but I need to pick up the same position() value for the <NATIONALPROVIDERID>, even if its empty.
The code I'm using picks up the first occurrence of <NATIONALPROVIDERID> but then the first occurrence of <NATIONALPROVIDERID> that is not blank from the second occurrence of <PRESCRIBINGPROVIDER>.
Code:
<xsl:variable name="varPrescriberName">
<xsl:value-of select="/doc/EOB/DETAIL/DETAILLINE/PRESCRIBINGPROVIDER[FULLNAME!='']/FULLNAME"/>
</xsl:variable>
<xsl:variable name="varPrescriberNPI">
<xsl:value-of select="/doc/EOB/DETAIL/DETAILLINE/PRESCRIBINGPROVIDER/NPIINFO[NATIONALPROVIDERID!='']/NATIONALPROVIDERID"/>
</xsl:variable>
Here's an example showing two occurrences of <PRESCRIBINGPROVIDER>.
Code:
<PRESCRIBINGPROVIDER>
<FULLNAME>FULLNAME LINE 1</FULLNAME>
<NPIINFO>
<NATIONALPROVIDERID></NATIONALPROVIDERID>
<QUALIFIER></QUALIFIER>
</NPIINFO>
</PRESCRIBINGPROVIDER>
<PRESCRIBINGPROVIDER>
<FULLNAME>FULLNAME LINE 2</FULLNAME>
<NPIINFO>
<NATIONALPROVIDERID>NPI LINE 2</NATIONALPROVIDERID>
<QUALIFIER></QUALIFIER>
</NPIINFO>
</PRESCRIBINGPROVIDER>
I need to be able to pick up <NATIONALPROVIDERID> from position(1) instead of position(2).
I've played around with the position function but have not been able to achieve what I need.
Any help will be greatly appreciated!
Rita