我有这个示例卡通EDI文件 -
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 *阿什塔比拉* OH * 44004〜 N1 * PE * LAKE AREA RECOVERY CENTER * FI * 346608640~ N3 * 2801 C. COURT~ N4 *阿什塔比拉* OH * 44004〜 REF * PQ * 1017〜 LX * 1〜 CLP * 444444 * 1 * 56.70 * 56.52 * 0 * MC * 0000000655555555 * 53〜 NM1 * QC * 1 * DUC4K *达菲*宽*** 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 *金* 86.76〜 数量* NE * 53〜 LQ * HE * MA92〜 PLB * 123456 * 19960930 * CV:9876514 * -1.27〜 SE * 27 * 07504123〜 GE * 1 * 1〜 IEA * 1 * 004075123〜
在EDI记事本中呈现此XML
'<?xml version="1.0" encoding="iso-8859-1" ?><Batch>
<Interchange type="ISA" auth-qual="00" security-qual="00" sender-qual="ZZ" sender-id="ASHTB" receiver-qual="ZZ" receiver-id="01017" date="040315" time="1005" standard="U" version="00401" control="004075123" ack="0" test="P" ><FunctionalGroup type="GS" group="HP" sender="ASHTB" receiver="01017" date="20040315" time="1005" control="1" standard="X" version="004010X091A1" ><Document type="835" name="Health Care Claim Payment/Advice">
<RepeatingSegment type="ST">
<Segment type="ST" name="Transaction Set Header">
<Element type="143" name="Transaction Set Identifier Code" value="Health Care Claim Payment/Advice">835</Element>
<Element type="329" name="Transaction Set Control Number">07504123</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="BPR">
<Segment type="BPR" name="Beginning Segment for Payment Order/Remittance Advice">
<Element type="305" name="Transaction Handling Code" value="Notification Only">H</Element>
<Element type="782" name="Monetary Amount">5.75</Element>
<Element type="478" name="Credit/Debit Flag Code" value="Credit">C</Element>
<Element type="591" name="Payment Method Code" value="Non-Payment Data">NON</Element>
<Element type="373" name="Date">20040315</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="TRN">
<Segment type="TRN" name="Trace">
<Element type="481" name="Trace Type Code" value="Current Transaction Trace Numbers">1</Element>
<Element type="127" name="Reference Identification">A04B001017.07504</Element>
<Element type="509" name="Originating Company Identifier">1346000128</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="DTM">
<Segment type="DTM" name="Date/Time Reference">
<Element type="374" name="Date/Time Qualifier" value="Production">405</Element>
<Element type="373" name="Date">20040308</Element>
</Segment>
</RepeatingSegment>
<Loop type="N1">
<RepeatingSegment type="N1">
<Segment type="N1" name="Name">
<Element type="98" name="Entity Identifier Code" value="Payer">PR</Element>
<Element type="93" name="Name">ASHTABULA COUNTY ADAMH BD</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="N3">
<Segment type="N3" name="Address Information">
<Element type="166" name="Address Information">4817 STATE ROAD SUITE 203</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="N4">
<Segment type="N4" name="Geographic Location">
<Element type="19" name="City Name">ASHTABULA</Element>
<Element type="156" name="State or Province Code">OH</Element>
<Element type="116" name="Postal Code">44004</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="N1">
<Segment type="N1" name="Name">
<Element type="98" name="Entity Identifier Code" value="Payee">PE</Element>
<Element type="93" name="Name">LAKE AREA RECOVERY CENTER </Element>
<Element type="66" name="Identification Code Qualifier" value="Federal Taxpayer's Identification Number">FI</Element>
<Element type="67" name="Identification Code">346608640</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="N3">
<Segment type="N3" name="Address Information">
<Element type="166" name="Address Information">2801 C. COURT</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="N4">
<Segment type="N4" name="Geographic Location">
<Element type="19" name="City Name">ASHTABULA</Element>
<Element type="156" name="State or Province Code">OH</Element>
<Element type="116" name="Postal Code">44004</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="REF">
<Segment type="REF" name="Reference Identification">
<Element type="128" name="Reference Identification Qualifier" value="Payee Identification">PQ</Element>
<Element type="127" name="Reference Identification">1017</Element>
</Segment>
</RepeatingSegment>
</Loop>
<Loop type="LX">
<RepeatingSegment type="LX">
<Segment type="LX" name="Assigned Number">
<Element type="554" name="Assigned Number">1</Element>
</Segment>
</RepeatingSegment>
<Loop type="CLP">
<RepeatingSegment type="CLP">
<Segment type="CLP" name="Claim Level Data">
<Element type="1028" name="Claim Submitter's Identifier">444444</Element>
<Element type="1029" name="Claim Status Code" value="Processed as Primary">1</Element>
<Element type="782" name="Monetary Amount">56.70</Element>
<Element type="782" name="Monetary Amount">56.52</Element>
<Element type="782" name="Monetary Amount">0</Element>
<Element type="1032" name="Claim Filing Indicator Code" value="Medicaid">MC</Element>
<Element type="127" name="Reference Identification">0000000655555555</Element>
<Element type="1331" name="Facility Code Value">53</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="NM1">
<Segment type="NM1" name="Individual or Organizational Name">
<Element type="98" name="Entity Identifier Code" value="Patient">QC</Element>
<Element type="1065" name="Entity Type Qualifier" value="Person">1</Element>
<Element type="1035" name="Name Last or Organization Name">DUC4K</Element>
<Element type="1036" name="Name First">DAFFY</Element>
<Element type="1037" name="Name Middle">W</Element>
<Element type="66" name="Identification Code Qualifier" value="Member Identification Number">MI</Element>
<Element type="67" name="Identification Code">1245849</Element>
</Segment>
<Segment type="NM1" name="Individual or Organizational Name">
<Element type="98" name="Entity Identifier Code" value="Rendering Provider">82</Element>
<Element type="1065" name="Entity Type Qualifier" value="Non-Person Entity">2</Element>
<Element type="1035" name="Name Last or Organization Name">ABTHSOLUTE HELP</Element>
<Element type="66" name="Identification Code Qualifier" value="Federal Taxpayer's Identification Number">FI</Element>
<Element type="67" name="Identification Code">346608640</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="REF">
<Segment type="REF" name="Reference Identification">
<Element type="128" name="Reference Identification Qualifier" value="Original Reference Number">F8</Element>
<Element type="127" name="Reference Identification">A76B04054</Element>
</Segment>
</RepeatingSegment>
<Loop type="SVC">
<RepeatingSegment type="SVC">
<Segment type="SVC" name="Service Information">
<Element type="235" name="Product/Service ID Qualifier" value="Health Care Financing Administration Common Procedural Coding System (HCPCS) ">HC</Element>
<Element type="234" name="Product/Service ID">H0004</Element>
<Element type="1339" name="Procedure Modifier">HF</Element>
<Element type="1339" name="Procedure Modifier">H9</Element>
<Element type="782" name="Monetary Amount">-86.76</Element>
<Element type="782" name="Monetary Amount">-86.76</Element>
<Element type="380" name="Quantity">-4</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="DTM">
<Segment type="DTM" name="Date/Time Reference">
<Element type="374" name="Date/Time Qualifier" value="Service Period Start">150</Element>
<Element type="373" name="Date">20040210</Element>
</Segment>
<Segment type="DTM" name="Date/Time Reference">
<Element type="374" name="Date/Time Qualifier" value="Service Period End">151</Element>
<Element type="373" name="Date">20040211</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="CAS">
<Segment type="CAS" name="Claims Adjustment">
<Element type="1033" name="Claim Adjustment Group Code" value="Correction and Reversals">CR</Element>
<Element type="1034" name="Claim Adjustment Reason Code">22</Element>
<Element type="782" name="Monetary Amount">0</Element>
<Element type="380" name="Quantity">0</Element>
<Element type="1034" name="Claim Adjustment Reason Code">42</Element>
<Element type="782" name="Monetary Amount">0</Element>
<Element type="380" name="Quantity">0</Element>
</Segment>
<Segment type="CAS" name="Claims Adjustment">
<Element type="1033" name="Claim Adjustment Group Code" value="Other adjustments">OA</Element>
<Element type="1034" name="Claim Adjustment Reason Code">22</Element>
<Element type="782" name="Monetary Amount">0</Element>
<Element type="380" name="Quantity">0</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="REF">
<Segment type="REF" name="Reference Identification">
<Element type="128" name="Reference Identification Qualifier" value="Provider Control Number">6R</Element>
<Element type="127" name="Reference Identification">090909</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="AMT">
<Segment type="AMT" name="Monetary Amount">
<Element type="522" name="Amount Qualifier Code" value="Coverage Amount">AU</Element>
<Element type="782" name="Monetary Amount">86.76</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="QTY">
<Segment type="QTY" name="Quantity">
<Element type="673" name="Quantity Qualifier" value="Non-Covered - Estimated">NE</Element>
<Element type="380" name="Quantity">53</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="LQ">
<Segment type="LQ" name="Industry Code">
<Element type="1270" name="Code List Qualifier Code" value="Claim Payment Remark Codes">HE</Element>
<Element type="1271" name="Industry Code">MA92</Element>
</Segment>
</RepeatingSegment>
</Loop>
</Loop>
</Loop>
<RepeatingSegment type="PLB">
<Segment type="PLB" name="Provider Level Adjustment">
<Element type="127" name="Reference Identification">123456</Element>
<Element type="373" name="Date">19960930</Element>
<Element type="426" name="Adjustment Reason Code" value="Capital Passthru">CV</Element>
<Element type="127" name="Reference Identification">9876514</Element>
<Element type="782" name="Monetary Amount">-1.27</Element>
</Segment>
</RepeatingSegment>
<RepeatingSegment type="SE">
<Segment type="SE" name="Transaction Set Trailer">
<Element type="96" name="Number of Included Segments">27</Element>
<Element type="329" name="Transaction Set Control Number">07504123</Element>
</Segment>
</RepeatingSegment>
</Document>
</FunctionalGroup>
</Interchange>
</Batch>'
**当我应用此XSLT **
时<?xml version="1.0" encoding="utf-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*|@*">
<xsl:apply-templates/>
<xsl:value-of select="','"/>
<xsl:text>
</xsl:text>
<xsl:value-of select="','"/>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
<xsl:if test="../following-sibling::*/text()">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:template>
</xsl:transform>
*我得到了这些结果*
00,,
,,
,00,,
,,
,ZZ,,
,ASHTB ,,
,ZZ,,
,01017 ,,
,040315,,
,1005,,
,U,,
,00401,,
,004075123,,
,0,,
,P,
,,
,,
,,
,,
,HP,,
,ASHTB,,
,01017,,
,20040315,,
,1005,,
,1,,
,X,,
,004010X091A1,
,,
,835,,
,07504123,
,,
,H,,
,5.75,,
,C,,
,NON,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,20040315,
,,
,1,,
,A04B001017.07504,,
,1346000128,
,,
,405,,
,20040308,
,,
,PR,,
,ASHTABULA COUNTY ADAMH BD,
,,
,4817 STATE ROAD SUITE 203,
,,
,ASHTABULA,,
,OH,,
,44004,
,,
,,
,PE,,
,LAKE AREA RECOVERY CENTER ,,
,FI,,
,346608640,
,,
,2801 C. COURT,
,,
,ASHTABULA,,
,OH,,
,44004,
,,
,PQ,,
,1017,
,,
,,
,1,
,,
,444444,,
,1,,
,56.70,,
,56.52,,
,0,,
,MC,,
,0000000655555555,,
,53,
,,
,QC,,
,1,,
,DUC4K,,
,DAFFY,,
,W,,
,,
,,
,MI,,
,1245849,
,,
,82,,
,2,,
,ABTHSOLUTE HELP,,
,,
,,
,,
,,
,FI,,
,346608640,
,,
,F8,,
,A76B04054,
,,
,HC,,
,H0004,,
,HF,,
,H9,
,,
,-86.76,,
,-86.76,,
,,
,-4,
,,
,150,,
,20040210,
,,
,151,,
,20040211,
,,
,CR,,
,22,,
,0,,
,0,,
,42,,
,0,,
,0,
,,
,OA,,
,22,,
,0,,
,0,
,,
,6R,,
,090909,
,,
,AU,,
,86.76,
,,
,NE,,
,53,
,,
,HE,,
,MA92,
,,
,,
,,
,,
,123456,,
,19960930,,
,CV,,
,9876514,
,,
,-1.27,
,,
,27,,
,07504123,
,,
,,
,1,,
,1,
,,
,,
,1,,
,004075123,
,,
,,
,
我想要的结果是什么 - 逗号替换了段行终结符〜。但是,我需要在同一行上的所有这些结果,如果存在捆绑的情况,那么这些结果将在新行上生成。我不知道如何实现这一目标?逗号创建的空字段是可以的,我可以稍后处理它们,我只需要所有字段和edi段终止符〜替换为逗号而不连接到其他字段。
似乎这里有一些容易的东西我想念,我是XSLT的新手,感谢您的帮助。
答案 0 :(得分:0)
这:
<xsl:text> 
 </xsl:text>
是换行符。如果你删除它,它应该把它放在同一行。换行是导致线断裂的原因。
答案 1 :(得分:0)
使用时:
<xsl:template match="*|@*">
<xsl:apply-templates/>
<xsl:value-of select="','"/>
<xsl:text>
</xsl:text>
您正在插入
每个元素后面的(换行)字符(您的模板适用于任何元素*
或任何属性@*
)。而不是它,你应该只在RepeatingSegment
元素的模板上使用它,如下所示:
<xsl:template match="RepeatingSegment">
<xsl:apply-templates/>
<xsl:text>
</xsl:text>
</xsl:template>
希望这有帮助。