Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7955535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:44:15+00:00 2026-06-04T03:44:15+00:00

I want to create multiple html table pages using XML as the input and

  • 0

I want to create multiple html table pages using XML as the input and xsl as the transformation language.
Now these tables should always have a fixed height, whether it’s just one row or ten.
I can’t get it to work with CSS (min-height).
So I was wondering, if it is possible to get xsl to always output ten rows and add empty rows in case there are less then ten rows or adding rows in case there are more then ten rows existent in the XML and therefore resizing the table.

Any ideas how this can be achieved?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:44:16+00:00Added an answer on June 4, 2026 at 3:44 am

    You sure can do that. I can show you how you would split your data into tables each having ten rows stuffing up the last one (or maybe the only one) with dummy rows when you don’t have enough. It should help you get going where you need to go (without an example XML input and desired HTML output this is as much as I can do)

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output method="html" encoding="UTF-8"/>
    
        <xsl:template match="/">
            <xsl:apply-templates select="data/row[position() mod 10 = 1]" mode="newtable"/>
        </xsl:template>
    
        <xsl:template match="row" mode="newtable">
            <table>
                <xsl:apply-templates select="."/>
                <xsl:apply-templates select="following-sibling::row[position() &lt; 10]"/>
                <xsl:call-template name="dummy-rows">
                    <xsl:with-param 
                           name="how-many" 
                           select="9 - count(following-sibling::row[position() &lt; 10])"/>
                </xsl:call-template>
            </table>
        </xsl:template>
    
        <xsl:template match="row">
            <tr><td><xsl:value-of select="."/></td></tr>
        </xsl:template>
    
        <xsl:template name="dummy-rows">
            <xsl:param name="how-many" select="0"/>
            <xsl:if test="$how-many &gt; 0">
                <tr><td>dummy</td></tr>
                <xsl:call-template name="dummy-rows">
                    <xsl:with-param name="how-many" select="$how-many - 1"/>
                </xsl:call-template>
            </xsl:if>
        </xsl:template>
    </xsl:stylesheet>
    

    The idea is that you start your table with the “first” node of each set of 10. That’s the [position() mod 10 = 1] predicate. When you get a hold of the starting point of your table you create the table boundaries and process that node again in a normal mode. Then you get the next nine data rows that follow it. Finally, you add as many dummy nodes as you need to make sure you got the 10 total in each table. The dummy-rows template is a recursion. So two techniques here: splitting the set by position() mod and using a recursion to implement iteration.

    UPDATE If you only need to make sure you have at least ten rows in your table then you don’t need the split logic:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output method="html" encoding="UTF-8"/>
    
        <xsl:template match="/">
            <table>
                <xsl:apply-templates select="data/row"/>
                <xsl:call-template name="dummy-rows">
                    <xsl:with-param 
                        name="how-many" 
                        select="10 - count(data/row)"/>
                </xsl:call-template>
            </table>
        </xsl:template>
    
        <xsl:template match="row">
            <tr><td><xsl:value-of select="."/></td></tr>
        </xsl:template>
    
        <xsl:template name="dummy-rows">
            <xsl:param name="how-many" select="0"/>
            <xsl:if test="$how-many &gt; 0">
                <tr><td>dummy</td></tr>
                <xsl:call-template name="dummy-rows">
                    <xsl:with-param name="how-many" select="$how-many - 1"/>
                </xsl:call-template>
            </xsl:if>
        </xsl:template>
    </xsl:stylesheet>
    

    You can try this with an input like this:

    <data>
      <row>1</row>
      <row>1</row>
      <row>3</row>
    </data>
    

    or an input like this:

    <data>
        <row>1</row>
        <row>2</row>
        <row>3</row>
        <row>4</row>
        <row>5</row>
        <row>6</row>
        <row>7</row>
        <row>8</row>
        <row>9</row>
        <row>10</row>
        <row>11</row>
        <row>12</row>
    </data>
    

    In both cases the result was as expected. Try it. You should be able to take it from here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create multiple versions of print-friendly pages from a single page. I
I have an XML file (on the left) and I want to create multiple
I'm trying to create an html table from database records. I want the table
Basically I want to load a HTML document and using controls such as multiple
I`v come across a need where I want to create multiple list items from
hey i want to be able to create multiple shapes and store them perhaps
I want to create an array that has multiple index and in each index
I want to create a UI that uses a tab control to display multiple
I want my code to automatically try multiple ways to create a database connection.
I wanna create a public repo (bare repo) which contains multiple submodules. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.