0

I'm new to XSLT and trying to use it generate HTML that will eventually be printed.

I have my XML

<Items>
   <Item>
      <Value>10</Value>
      <Description>ABC</Description>
   </Item>
   <Item>
      <Value>20</Value>
      <Description>DEF</Description>
   </Item>
   <Item>
      <Value>30</Value>
      <Description>GHI</Description>
   </Item>
</Items>

That's just a sample but the XML could be much bigger.

My XSLT looks like this

<xsl:for-each select="ArrayOfItems/Item">
    <tr>
        <td>
            <xsl:value-of select="Value"/>
        </td>
        <td>
            <xsl:value-of select="Description"/>
        </td>
    </tr>
</xsl:for-each>

It's possible that the XML data could be so large that it flows to another page when printed.

Is there a way I can figure out if the current item to be generated in the HTML table will be the last to fit on the base so instead I can output a line that says "Continued on the next page"?

James
  • 419
  • 4
  • 25
  • Detecting the last node is covered in https://stackoverflow.com/questions/1738832/xsl-for-each-how-to-detect-last-node – Grisha Levit Jan 17 '17 at 21:27
  • If you know exactly how many table rows will fit on a page, you could have your XSLT stylesheet split the input into separate tables, so that each table occupies one page. Otherwise you need to look for alternative solutions such as CSS (which, if feasible, would be preferable in any case). – michael.hor257k Jan 17 '17 at 21:51
  • If the target format is HTML and you want to print that HTML then these days CSS page/print style https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Pages help – Martin Honnen Jan 17 '17 at 21:52

0 Answers0