Home > Blockchain >  XSL creating fo-tables for inline-container results
XSL creating fo-tables for inline-container results

Time:05-05

I have a situation where I need to display xml results (boolean, dates, i

I want to have the results display in a table and can't figure out a good way to go about this without a full rebuild of the entire process.

Here is an example of how I handle the boolean dataType. Each dataType is built off of the example below.

Here is the code to apply all the templates(Boolean, etc..). I am trying to figure out if I can create a Table display for the apply-templates select=".", or if I would need to edit every DataType to work with displaying into a table.

CodePudding user response:

The important thing is to not miss any levels in the fo:table/fo:table-body/fo:table-row/fo:table-cell hierarchy.

If I understand your code correctly, you want something like:

<fo:table>
  <fo:table-column column-width="{$adjustedWidth}in" />
  <fo:table-column column-width="{$adjustedWidth}in" />
  <fo:table-body>
    <xsl:for-each select="bml:Parameter[not(bml:ID='EndConditionMatrix' or
                                            bml:ID='PVATable' or
                                            bml:ParameterSubType='NoReport')]">
      <xsl:sort select="bml:SortOrder" data-type="number"/>
      <xsl:apply-templates select="." />
    </xsl:for-each>
  </fo:table-body>
</fo:table>

and:

<xsl:template match="bml:DataType='boolean']">
  <fo:table-row>
    <fo:table-cell>
      <fo:block xsl:use-attribute-sets="paramCaption">
        <xsl:value-of select="$caption" />
      </fo:block>
    </fo:table-cell>
    <fo:table-cell>
      <fo:block xsl:use-attribute-sets="paramValue">
        <xsl:choose>
          <xsl:when test="bml:Value/bml:ValueString='0'">No</xsl:when>
          <xsl:otherwise>Yes</xsl:otherwise>
        </xsl:choose>
      </fo:block>
    </fo:table-cell>
  </fo:table-row>
</xsl:template>

That doesn't account for your start-indent, but it should get you some way towards what you want.

  • Related