我希望将所有输出XML(使用xsl if condition)保留在一行中。我正在使用以下XML和XSLT。 请帮助使用XSLT代码如何将所有Output xml放在一行中。
输入XML
<root>
<row>
<POC_ID>1</POC_ID>
<POC_ACT_NO>212568898</POC_ACT_NO>
<POC_DBT_NO>2000</POC_DBT_NO>
<POC_COURT_NAME>Detroit Municipal</POC_COURT_NAME>
<POC_PLAINTIFF>JohnJackson</POC_PLAINTIFF>
<POC_DEFENDANT>Bob Golic</POC_DEFENDANT>
<POC_DEFENDANT02>Teddy Newman</POC_DEFENDANT02>
<POC_DEFENDANT03></POC_DEFENDANT03>
<POC_DEFENDANT04></POC_DEFENDANT04>
<POC_CASE_NO>23-231501</POC_CASE_NO>
<POC_INT_RATE>3.5</POC_INT_RATE>
<POC_INT_FRM_CMPLT>35.25</POC_INT_FRM_CMPLT>
<POC_INT_FRM_DOJ>0.00</POC_INT_FRM_DOJ>
<POC_DWN_PMT>525.00</POC_DWN_PMT>
<POC_PMT_DUE_DATE>7/19/2015</POC_PMT_DUE_DATE>
<POC_PERIODIC_AMT>75.00</POC_PERIODIC_AMT>
<POC_PERIODIC_PMT_DUE_DATE>25</POC_PERIODIC_PMT_DUE_DATE>
<POC_PMT_FREQ>BWK</POC_PMT_FREQ>
<POC_DWNPMT>Y</POC_DWNPMT>
<POC_INTCMP_FLG>Y</POC_INTCMP_FLG>
<POC_INTDOJ_FLG>N</POC_INTDOJ_FLG>
<POC_LANG_REMOVED>N</POC_LANG_REMOVED>
<DAY_OF_THE_WEEK>4</DAY_OF_THE_WEEK>
<NUMBER_OF_PAYMENTS>23</NUMBER_OF_PAYMENTS>
<PAYMENT_REVIEW_DATE>08/02/2014</PAYMENT_REVIEW_DATE>
</row>
</root>
请帮助使用XSLT代码如何将所有Output xml放在一行中。
XSL代码:
<xsl:template match="root">
<root>
<xsl:for-each select="row">
<xsl:variable name="Pmt_freq" >
<xsl:value-of select="POC_PMT_FREQ"/>
</xsl:variable>
<xsl:variable name="downPayment" >
<xsl:value-of select="POC_DWNPMT"/>
</xsl:variable>
<xsl:variable name="cmpFlag" >
<xsl:value-of select="POC_INTCMP_FLG"/>
</xsl:variable>
<xsl:variable name="dojFlag" >
<xsl:value-of select="POC_INTDOJ_FLG"/>
</xsl:variable>
<xsl:variable name="pocLang" >
<xsl:value-of select="POC_LANG_REMOVED"/>
</xsl:variable>
<row>
<DefTitle>
<xsl:value-of select="POC_DEFENDANT"/>
</DefTitle>
<TotalJudgement>
<xsl:value-of select="POC_DWN_PMT +(POC_INT_FRM_CMPLT + POC_INT_FRM_DOJ * POC_INT_RATE)" />
</TotalJudgement>
<MICJEINT>
<xsl:if test="$Pmt_freq='MWD' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="DAY_OF_THE_WEEK"/> of each month thereafter until this Judgment is paid in full.
</xsl:if>
<xsl:if test="$Pmt_freq='BIW' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of every other week thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='BIW' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of every other week thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='BMO' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of every month thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='BMO' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='BWK' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each week thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='BWK' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each week thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='MON' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='MON' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/> and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='BIF' and $downPayment='Y'">
shall pay the sum of <xsl:value-of select="POC_DWN_PMT"/> on or before<xsl:value-of select="POC_PMT_DUE_DATE"/>
</xsl:if>
<xsl:if test="$Pmt_freq='BIF' and $downPayment='N'">
shall pay the sum of <xsl:value-of select="POC_DWN_PMT"/> on or before<xsl:value-of select="POC_PMT_DUE_DATE"/>
</xsl:if>
<xsl:if test="$Pmt_freq='MWD' and $downPayment='Y'">
shall pay this Judgment with the first payment of<xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the 4th day of each month thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='SMU' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_AMT"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month thereafter until this Judgment is paid in full;
</xsl:if>
<xsl:if test="$Pmt_freq='SMU' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PMT_DUE_DATE"/> and <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month thereafter until this Judgment is paid in full;
</xsl:if>
<xsl:if test="$Pmt_freq='WEK' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each week thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='WEK' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each week thereafter until this Judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='PAR' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month for <xsl:value-of select="NUMBER_OF_PAYMENTS"/>. On <xsl:value-of select="PAYMENT_REVIEW_DATE"/> Plaintiff will review for increase of said payments
</xsl:if>
<xsl:if test="$Pmt_freq='PAR' and $downPayment='N'">
shall pay this Judgment with the first payment of<xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month for <xsl:value-of select="NUMBER_OF_PAYMENTS"/>>. On <xsl:value-of select="PAYMENT_REVIEW_DATE"/> Plaintiff will review for increase of said payments
</xsl:if>
<xsl:if test="Pmt_freq='QTR' and $downPayment='Y'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of every three (3) months there after until this judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='QTR' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of every three (3) months there after until this judgment is paid in full
</xsl:if>
<xsl:if test="$Pmt_freq='SET' and $downPayment='Y'">
Shall pay the sum of <xsl:value-of select="POC_PERIODIC_AMT"/> on of before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>
</xsl:if>
<xsl:if test="$Pmt_freq='SET' and $downPayment='N'">
Shall pay the sum of <xsl:value-of select="POC_PERIODIC_AMT"/> on of before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>
</xsl:if>
<xsl:if test="$Pmt_freq='SMO' and $downPayment='Y'">
sshall pay this Judgment with the first payment of <xsl:value-of select="POC_DWN_PMT"/> due on or before <xsl:value-of select="POC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PMT_DUE_DATE"/> of each month On <xsl:value-of select="PAYMENT_REVIEW_DATE"/> Plaintiff will review for increase of said payments
</xsl:if>
<xsl:if test="$Pmt_freq='SMO' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/> of each month. On <xsl:value-of select="PAYMENT_REVIEW_DATE"/> Plaintiff will review for increase of said payments
</xsl:if>
</MICJEINT>
<MICJEINT01>
<xsl:if test="$cmpFlag='Y' and $dojFlag='N' and $pocLang='N'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
<xsl:if test="$cmpFlag='Y' and $dojFlag='N' and $pocLang='y'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
<xsl:if test="$cmpFlag='Y' and $dojFlag='y' and $pocLang='N'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
<xsl:if test="$cmpFlag='Y' and $dojFlag='y' and $pocLang='y'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
<xsl:if test="$cmpFlag='N' and $dojFlag='N' and $pocLang='N'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
<xsl:if test="$cmpFlag='N' and $dojFlag='N' and $pocLang='y'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
<xsl:if test="$cmpFlag='N' and $dojFlag='Y' and $pocLang='N'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
<xsl:if test="$cmpFlag='N' and $dojFlag='Y' and $pocLang='Y'">
plus interest accruing at <xsl:value-of select="POC_INT_RATE"/> % since the filing of Plaintiff’s Complaint pursuant to MCL §600.6013
</xsl:if>
</MICJEINT01>
</row>
</xsl:for-each>
<xsl:text>
</xsl:text>
</root>
</xsl:template>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</xsl:stylesheet>
请帮助使用XSLT代码如何将所有Output xml放在一行中。
答案 0 :(得分:0)
嗯,你似乎生成XML输出,所以如果你真的想要一行就是第一件事就是确保你有<xsl:output method="xml" indent="no"/>
,当然你需要确保你不输出任何换行符所以你需要改变代码
<xsl:if test="$Pmt_freq='MWD' and $downPayment='N'">
shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="DAY_OF_THE_WEEK"/> of each month thereafter until this Judgment is paid in full.
</xsl:if>
要做
<xsl:if test="$Pmt_freq='MWD' and $downPayment='N'">shall pay this Judgment with the first payment of <xsl:value-of select="POC_PERIODIC_AMT"/> due on or before <xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>, and subsequent payments of <xsl:value-of select="POC_PERIODIC_AMT"/> on or before the <xsl:value-of select="DAY_OF_THE_WEEK"/> of each month thereafter until this Judgment is paid in full.</xsl:if>
对于您拥有的所有其他结果文本节点等等。
答案 1 :(得分:0)
嗨,最后我得到了答案,就像是:
<xsl:if test="$Pmt_freq='BWK' and $downPayment='Y'">
<xsl:text>shall pay this Judgment with the first payment of</xsl:text>
<xsl:value-of select="POC_DWN_PMT"/>
<xsl:text>due on or before</xsl:text>
<xsl:value-of select="POC_PMT_DUE_DATE"/>
<xsl:text>and subsequent payments of</xsl:text>
<xsl:value-of select="POC_PERIODIC_AMT"/>
<xsl:text>on or before the </xsl:text>
<xsl:value-of select="POC_PERIODIC_PMT_DUE_DATE"/>
<xsl:text> each week thereafter until this Judgment is paid in full </xsl:text>
</xsl:if>