HIPAA 5010 to csv via XSLT - Loop Path issue? -
i attempting larn xlst extracting info edi 837/835 files. below place fields specified loop 2100 in cvs format, not fields loop 2110. stylesheet below homecoming fields loop 2110 not 2100. how combine loops homecoming fields both 2100 , 2110 in 1 stylesheet? have tried several options , have been unsuccessful returning fields in csv format. ideas? help appreciated. 835 test file id @ bottom.
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="text" indent="yes"/> <xsl:template match="interchange"> <xsl:apply-templates select="functiongroup/transaction/loop[@loopid='2000']/loop [@loopid='2100']"/> </xsl:template> <xsl:template match="loop[@loopid='2100'] "> <xsl:variable name="trans" select="../../."/> <xsl:variable name="payer" select="../../loop[@loopid='1000a']"/> <xsl:variable name="payee" select="../../loop[@loopid='1000b']"/> <xsl:variable name="payment" select="."/> <xsl:variable name="cas" select="../../loop[@loopid='2110']"/> <xsl:variable name="caxx" select="."/> <xsl:value-of select="$trans/bpr/bpr16"/> <xsl:value-of select="','"/> <xsl:value-of select="$caxx/n1/n102"/> <xsl:value-of select="','"/> <xsl:value-of select="$payee/n1/n102"/> <xsl:value-of select="','"/> <xsl:value-of select="$payee/n1/n104"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/clp/clp01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/clp/clp02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/clp/clp03"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/nm1[nm101='qc']/nm103"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/nm1[nm101='qc']/nm104"/> <xsl:value-of select="','"/> <xsl:value-of select="$cas/dtm[dtm01='472']/dtm02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='co']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='co']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='cr']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='cr']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='oa']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='oa']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pi']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pi']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pr']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pr']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/ref[ref01='6r']/ref02"/> <xsl:value-of select="','"/> <xsl:value-of select="$cas/cas[cas01='pr']/cas02"/> <xsl:value-of select="','"/> <xsl:text>
</xsl:text> </xsl:template> </xsl:stylesheet>
------------------------------------ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="text" indent="yes"/> <xsl:template match="interchange"> <xsl:apply-templates select="functiongroup/transaction/loop[@loopid='2000']/loop [@loopid='2100']/loop[@loopid='2110']"/> </xsl:template> <xsl:template match="loop[@loopid='2110'] "> <xsl:variable name="trans" select="../../."/> <xsl:variable name="payer" select="../../loop[@loopid='1000a']"/> <xsl:variable name="payee" select="../../loop[@loopid='1000b']"/> <xsl:variable name="payment" select="."/> <xsl:variable name="cas" select="../../loop[@loopid='2110']"/> <xsl:variable name="caxx" select="."/> <xsl:value-of select="$trans/bpr/bpr16"/> <xsl:value-of select="','"/> <xsl:value-of select="$caxx/n1/n102"/> <xsl:value-of select="','"/> <xsl:value-of select="$payee/n1/n102"/> <xsl:value-of select="','"/> <xsl:value-of select="$payee/n1/n104"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/clp/clp01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/clp/clp02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/clp/clp03"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/nm1[nm101='qc']/nm103"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/nm1[nm101='qc']/nm104"/> <xsl:value-of select="','"/> <xsl:value-of select="$cas/dtm[dtm01='472']/dtm02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='co']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='co']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='cr']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='cr']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='oa']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='oa']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pi']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pi']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pr']/cas01"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/cas[cas01='pr']/cas02"/> <xsl:value-of select="','"/> <xsl:value-of select="$payment/ref[ref01='6r']/ref02"/> <xsl:value-of select=",'"/> <xsl:value-of select="$cas/cas[cas01='pr']/cas02"/> <xsl:value-of select="','"/> <xsl:text>
</xsl:text> </xsl:template> </xsl:stylesheet>
---------835 file
isa*00* *00* *zz*ashtb *zz*01017 *040315*1005*u*00401*004075123*0*p*:~ gs*hp*ashtb*01017*20040315*1005*1*x*004010x091a1~ st*835*07504123~ bpr*h*5.75*c*non************20040315~ trn*1*a04b001017.07504*1346000128~ dtm*405*20040308~ n1*pr*ashtabula county adamh bd~ n3*4817 state road suite 203~ n4*ashtabula*oh*44004~ n1*pe*lake area recovery center *fi*346608640~ n3*2801 c. court~ n4*ashtabula*oh*44004~ ref*pq*1017~ lx*1~ clp*444444*1*56.70*56.52*0*mc*0000000655555555*53~ nm1*qc*1*fudd*elmer*s***mi*1333333~ nm1*82*2*wecoverwy svcs*****fi*346608640~ ref*f8*a76b04054~ svc*hc:h0005:hf:h9*56.70*56.52**6~ dtm*472*20040205~ cas*co*42*0.18*0~ ref*6r*444444~ clp*999999*4*25.95*0*25.95*13*0000000555555555*11~ nm1*qc*1*sam*yosemite*a***mi*3333333~ nm1*82*2*acme agency*****fi*310626223~ ref*f8*h57b10401~ svc*zz:m2200:he*25.95*0**1~ dtm*472*20021224~ cas*cr*18*25.95*0~ cas*co*42*0*0~ ref*6r*999999~ clp*888888*4*162.13*0*162.13*mc*0000000456789123*11~ nm1*qc*1*squarepants*bob* ***mi*2222222~ nm1*82*2*bikini agency*****fi*310626223~ ref*f8*h57b10401~ svc*zz:m151000:f0*162.13*0**1.9~ dtm*472*20020920~ cas*co*29*162.13*0*42*0*0~ ref*6r*888888~ clp*111111*2*56.52*18.88*0*13*0000000644444444*53~ nm1*qc*1*leghorn*foghorn*p***mi*7777777~ nm1*82*2*chickenhawk svcs*****fi*346608640~ ref*f8*a76b04054~ svc*hc:h0005:hf:h9*56.52*18.88**6~ dtm*472*20031209~ cas*co*42*0*0~ cas*oa*23*37.64*0~ ref*6r*111111~ clp*121212*4*56.52*0*0*13*0000000646464640*53~ nm1*qc*1*explorer*dora****mi*1717171~ nm1*82*2*swiper agency*****fi*346608640~ ref*f8*a76b04054~ svc*hc:h0005:hf:h9*56.52*0**6~ dtm*472*20031202~ cas*co*42*0*0~ cas*oa*23*57.6*0*23*-1.08*0~ ref*6r*121212~ clp*333333*1*74.61*59.69*14.92*13*0000000688888888*55~ nm1*qc*1*bear*yogi* ***mi*2222222~ nm1*82*2*jellystone svcs*****fi*346608640~ ref*f8*a76b04054~ svc*zz:a0230:hf*74.61*59.69**1~ dtm*472*20040203~ cas*pr*2*14.92*0~ cas*co*42*0*0~ ref*6r*333333~ clp*777777*25*136.9*0*0*13*0000000622222222*53~ nm1*qc*1*bird*tweety*m***mi*4444444~ nm1*82*2*granny agency*****fi*340716747~ ref*f8*a76b03293~ svc*hc:h0015:hf:99:h9*136.9*0**1~ dtm*472*20030911~ cas*pi*104*136.72*0~ cas*co*42*0.18*0~ ref*6r*777777~ clp*123456*22*-42.58*-42.58*0*13*0000000657575757*11~ nm1*qc*1*simpson*homer* ***mi*8787888~ nm1*82*2*doh group*****fi*310626223~ ref*f8*a57b04033~ svc*hc:h0036:gt:uk*-42.58*-42.58**-2~ dtm*472*20040102~ cas*cr*141*0*0*42*0*0*22*0*0~ cas*oa*141*0*0~ ref*6r*123456~ clp*090909*22*-86.76*-86.76*0*mc*0000000648484848*53~ nm1*qc*1*duck*daffy*w***mi*1245849~ nm1*82*2*abthsolute help*****fi*346608640~ ref*f8*a76b04054~ svc*hc:h0004:hf:h9*-86.76*-86.76**-4~ dtm*150*20040210~ dtm*151*20040211~ cas*cr*22*0*0*42*0*0~ cas*oa*22*0*0~ ref*6r*090909~ amt*au*86.76~ qty*ne*53~ lq*he*ma92~ plb*123456*19960930*cv:9876514*-1.27~ se*97*07504123~ ge*1*1~ iea*1*004075123~
looking @ 2 stylesheets, differences xsl:apply-templates
<xsl:apply-templates select="functiongroup/transaction/loop[@loopid='2000']/loop [@loopid='2100']"/>
and respective template match
<xsl:template match="loop[@loopid='2100'] ">
in both cases "2100" , "2110" differ.
to allow first xslt manage both "2100" , "2110" records, replace existing single xsl:apply-templates these:
<xsl:apply-templates select="functiongroup/transaction/loop[@loopid='2000']/loop[@loopid='2100']"/> <xsl:apply-templates select="functiongroup/transaction/loop[@loopid='2000']/loop[@loopid='2110']"/>
then, alter template match this, share template
<xsl:template match="loop[@loopid='2100' or @loopid='2110'] ">
try (abridged) xslt, combines 2 xslt stylesheets one
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="text" indent="yes"/> <xsl:template match="interchange"> <xsl:apply-templates select="functiongroup/transaction/loop[@loopid='2000']/loop[@loopid='2100']"/> <xsl:apply-templates select="functiongroup/transaction/loop[@loopid='2000']/loop[@loopid='2110']"/> </xsl:template> <xsl:template match="loop[@loopid='2100' or @loopid='2110'] "> <xsl:variable name="trans" select="../../."/> <xsl:variable name="caxx" select="."/> <xsl:value-of select="$trans/bpr/bpr16"/> <xsl:value-of select="','"/> <xsl:value-of select="$caxx/n1/n102"/> <xsl:text>
</xsl:text> </xsl:template> </xsl:stylesheet>
loops xslt export-to-csv edi hipaa
No comments:
Post a Comment