Hi,
I have a report generated from an xml doc. I am using XSLT 1.0, XALAN and am rendering a PDF in FOP 0.20.5. I am using Netbeans for editing.
I have this report completely working except for the blank lines in the finished output. I've tried normalize-space, <text />, strip space, string-lenght > 0, and white space collapse but nothing seems to work.
Could somebody help me with this?
The XML document returns a list of questions per section with various responses. The hierarchy is report/audit/questions/question/audit_response/resp. I am bringing back a unique response per section (i.e. no response is repeated twice in the same section) then I do a count of these responses. This is working fine and the results are what I want. The only problem is that the output is showing blank lines between the responses.
This is the current output:
1-0-0 (a section header)
NO ( a unique response) 10 (count of NO responses)
Yes 4
I need it to output:
1-0-0
NO 10
Yes 4
This is the part of the sytlesheet for this:
<!--brings back unique responses -->
<fo:table-row>
<fo:table-cell>
<fo:block font="Arial" text-align="left" font-size="8pt" font-weight="normal" space-after="2px">
<xsl:choose>
<xsl:when test="sec_id">
<xsl:if test="not(audit_response/resp='')">
<xsl:if test="sec_id=$test">
<xsl:for-each select="audit_response/resp[1][not(.=preceding::audit_response/resp[1])] | audit_response/resp[1][not(.=following::audit_response/resp[1])]">
<text /><xsl:value-of select="."/><text />
</xsl:for-each>
</xsl:if>
</xsl:if>
</xsl:when>
</xsl:choose>
</fo:block>
</fo:table-cell>
Snippet of very long XML doc:
<?xml version="1.0" encoding="UTF-8" ?>
- <report>
- <audit>
<auditid>159</auditid>
<auditlevel_id>21</auditlevel_id>
<levelstring>AUDIT LIBRARY</levelstring>
<auditname>Cory</auditname>
<cust_id>2</cust_id>
<ld>1</ld>
<li>8</li>
- <questions>
- <question>
<id>13756</id>
<sec_id>0</sec_id>
<sub_sec_id>0</sub_sec_id>
<item_id>0</item_id>
<questiontype>Header</questiontype>
<resp_num>1</resp_num>
<itemdescription>Cory</itemdescription>
<possible_score>10.00</possible_score>
<score_criteria />
<udf_info />
- <audit_response>
<id>13389</id>
<questionid>13756</questionid>
<resp />
<narr />
<score>.00</score>
<p_o>0</p_o>
<n_o>0</n_o>
<p_f>0</p_f>
<n_f>0</n_f>
<answered>0</answered>
<udf_info />
<corr_acts />
</audit_response>
</question>
- <question>
<id>13757</id>
<sec_id>1</sec_id>
<sub_sec_id>0</sub_sec_id>
<item_id>0</item_id>
<questiontype>Header</questiontype>
<resp_num>1</resp_num>
<itemdescription>Section 1 - Enter section 1 description.</itemdescription>
<possible_score>10.00</possible_score>
<score_criteria />
<udf_info />
- <audit_response>
<id>13390</id>
<questionid>13757</questionid>
<resp />
<narr />
<score>.00</score>
<p_o>0</p_o>
<n_o>0</n_o>
<p_f>0</p_f>
<n_f>0</n_f>
<answered>0</answered>
<udf_info />
<corr_acts />
</audit_response>
</question>
Thanks
I have a report generated from an xml doc. I am using XSLT 1.0, XALAN and am rendering a PDF in FOP 0.20.5. I am using Netbeans for editing.
I have this report completely working except for the blank lines in the finished output. I've tried normalize-space, <text />, strip space, string-lenght > 0, and white space collapse but nothing seems to work.
Could somebody help me with this?
The XML document returns a list of questions per section with various responses. The hierarchy is report/audit/questions/question/audit_response/resp. I am bringing back a unique response per section (i.e. no response is repeated twice in the same section) then I do a count of these responses. This is working fine and the results are what I want. The only problem is that the output is showing blank lines between the responses.
This is the current output:
1-0-0 (a section header)
NO ( a unique response) 10 (count of NO responses)
Yes 4
I need it to output:
1-0-0
NO 10
Yes 4
This is the part of the sytlesheet for this:
<!--brings back unique responses -->
<fo:table-row>
<fo:table-cell>
<fo:block font="Arial" text-align="left" font-size="8pt" font-weight="normal" space-after="2px">
<xsl:choose>
<xsl:when test="sec_id">
<xsl:if test="not(audit_response/resp='')">
<xsl:if test="sec_id=$test">
<xsl:for-each select="audit_response/resp[1][not(.=preceding::audit_response/resp[1])] | audit_response/resp[1][not(.=following::audit_response/resp[1])]">
<text /><xsl:value-of select="."/><text />
</xsl:for-each>
</xsl:if>
</xsl:if>
</xsl:when>
</xsl:choose>
</fo:block>
</fo:table-cell>
Snippet of very long XML doc:
<?xml version="1.0" encoding="UTF-8" ?>
- <report>
- <audit>
<auditid>159</auditid>
<auditlevel_id>21</auditlevel_id>
<levelstring>AUDIT LIBRARY</levelstring>
<auditname>Cory</auditname>
<cust_id>2</cust_id>
<ld>1</ld>
<li>8</li>
- <questions>
- <question>
<id>13756</id>
<sec_id>0</sec_id>
<sub_sec_id>0</sub_sec_id>
<item_id>0</item_id>
<questiontype>Header</questiontype>
<resp_num>1</resp_num>
<itemdescription>Cory</itemdescription>
<possible_score>10.00</possible_score>
<score_criteria />
<udf_info />
- <audit_response>
<id>13389</id>
<questionid>13756</questionid>
<resp />
<narr />
<score>.00</score>
<p_o>0</p_o>
<n_o>0</n_o>
<p_f>0</p_f>
<n_f>0</n_f>
<answered>0</answered>
<udf_info />
<corr_acts />
</audit_response>
</question>
- <question>
<id>13757</id>
<sec_id>1</sec_id>
<sub_sec_id>0</sub_sec_id>
<item_id>0</item_id>
<questiontype>Header</questiontype>
<resp_num>1</resp_num>
<itemdescription>Section 1 - Enter section 1 description.</itemdescription>
<possible_score>10.00</possible_score>
<score_criteria />
<udf_info />
- <audit_response>
<id>13390</id>
<questionid>13757</questionid>
<resp />
<narr />
<score>.00</score>
<p_o>0</p_o>
<n_o>0</n_o>
<p_f>0</p_f>
<n_f>0</n_f>
<answered>0</answered>
<udf_info />
<corr_acts />
</audit_response>
</question>
Thanks