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 8017543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:52:31+00:00 2026-06-04T20:52:31+00:00

I am trying to create a gap between rows everytime the value of ‘column3’

  • 0

I am trying to create a gap between rows everytime the value of ‘column3’ changes. At the moment the gap is set to appear every 2 rows which is not what i need.
For example the value of ‘column3’ in the first 10 rows is 1,1,3,3,3,3,5,5,5,5
And i want a gap between the last ‘1’ and first ‘3’ etc.

 <xsl:for-each select="Market">
        <tr>
          <td>
            <xsl:value-of select="Column1"/>
          </td>
          <td>
            <xsl:value-of select="Column2"/>
          </td>
          <td>
            <xsl:value-of select="Column3"/>
          </td>
        </tr>
          <xsl:if test="(position() mod 2 = 0)">
          <tr>
            <td colspan="5" height="25px" />
          </tr>
        </xsl:if>
  • 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-04T20:52:33+00:00Added an answer on June 4, 2026 at 8:52 pm

    You could make use of the following-sibling axis in XPath to do this.

    <xsl:if test="Column3 != following-sibling::Market[1]/Column3">
    

    i.e. Does the very next Market element have a Column3 element with a different value.

    For example, given the following XML

    <Markets>
        <Market>
            <Column1>A</Column1>
            <Column3>1</Column3>
        </Market>
        <Market>
            <Column1>A</Column1>
            <Column3>1</Column3>
        </Market>
        <Market>
            <Column1>A</Column1>
            <Column3>3</Column3>
        </Market>
        <Market>
            <Column1>A</Column1>
            <Column3>3</Column3>
        </Market>
        <Market>
            <Column1>A</Column1>
            <Column3>3</Column3>
        </Market>
        <Market>
            <Column1>A</Column1>
            <Column3>3</Column3>
        </Market>
        <Market>
            <Column1>B</Column1>
            <Column3>4</Column3>
        </Market>
        <Market>
            <Column1>B</Column1>
            <Column3>4</Column3>
        </Market>
    </Markets>
    

    When you apply the following XSLT

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output method="html" indent="yes"/>
       <xsl:template match="/Markets">
          <table>
             <xsl:apply-templates select="Market"/>
          </table>
       </xsl:template>
    
       <xsl:template match="Market">
          <tr>
             <td>
                <xsl:value-of select="Column1"/>
             </td>
             <td>
                <xsl:value-of select="Column3"/>
             </td>
          </tr>
          <xsl:if test="Column3 != following-sibling::Market[1]/Column3">
             <tr>
                <td colspan="2" height="25px"/>
             </tr>
          </xsl:if>
       </xsl:template>
    </xsl:stylesheet>
    

    Then the following is output

    <table>
       <tr>
          <td>A</td>
          <td>1</td>
       </tr>
       <tr>
          <td>A</td>
          <td>1</td>
       </tr>
       <tr>
          <td colspan="2" height="25px"/>
       </tr>
       <tr>
          <td>A</td>
          <td>3</td>
       </tr>
       <tr>
          <td>A</td>
          <td>3</td>
       </tr>
       <tr>
          <td>A</td>
          <td>3</td>
       </tr>
       <tr>
          <td>A</td>
          <td>3</td>
       </tr>
       <tr>
          <td colspan="2" height="25px"/>
       </tr>
       <tr>
          <td>B</td>
          <td>4</td>
       </tr>
       <tr>
          <td>B</td>
          <td>4</td>
       </tr>
    </table>
    

    (Note, I missed out Column2 just for some brevity).

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

Sidebar

Related Questions

I'm trying to create a db using SQLITE on phone gap[cordova 1.7.0] with IOS5.
I'm trying create a gui using Tkinter that grabs a username and password and
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I am trying create a delegate representation of constructor by emitting a Dynamic Method,
Ok so I am trying create a login script, here I am using PHP5
In my android application I am trying create persistent connection for downloading images. Here
Trying to create a table with a bigint column creates a standard integer column
Trying to create a prayer time app for prayertimes in Oslo. I have a
trying to create simple package with one procedure: CREATE OR REPLACE PACKAGE PACKAGE1 AS
Trying to create a regex pattern for email address check. That will allow a

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.