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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:13:18+00:00 2026-05-22T14:13:18+00:00

I have an xslt style sheet that formats the data from my xml file

  • 0

I have an xslt style sheet that formats the data from my xml file into a table with a single column based on whether there is an image present or not. There is a fair amount of data so the column is too long though and i want to try splitting the current column into 2 equal columns. And idea how i can do this?

    <?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="0" bordercolor="#606060" style="width:200px">
  <tr bgcolor="white" width="200px">
  </tr>
  <xsl:for-each select="NewDataSet/Manufacturer">
    <tr>
      <xsl:choose>
        <xsl:when test="Image = 'none'">
          <td bgcolor="#dfdfdf">
            <a href="Vehicles.aspx?Manufacturer={ManufacturerID}" style="text-decoration:none;" runat="server">
              <xsl:value-of select="Manufacturer"/>
            </a>
          </td>
        </xsl:when>
        <xsl:otherwise>
          <td>
            <a href="Vehicles.aspx?Manufacturer={ManufacturerID}" style="text-decoration:none;" runat="server">
              <im alt="{Manufacturer}" src="Images/Manufacturers/{Image}" style="border-width: 0px; width: 50px; "/>
            </a>
          </td>
        </xsl:otherwise>
      </xsl:choose>
    </tr>
  </xsl:for-each>
</table>
</xsl:template>

  • 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-05-22T14:13:19+00:00Added an answer on May 22, 2026 at 2:13 pm

    how about something like this

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <table border="0" bordercolor="#606060" style="width:200px">
        <tr bgcolor="white" width="200px">
        </tr>
        <tr>
        <xsl:for-each select="NewDataSet/Manufacturer">
            <xsl:choose>
                <xsl:when test="position() mod 2 = 0">
                    <!-- so essentialy on even numbered elements process the current and next elements -->
                    <td>
                        <xsl:call-template name="do-cell-content">
                            <xsl:with-param name="node" select="."/>
                        </xsl:call-template>
                    </td>
                    <td>
                        <xsl:call-template name="do-cell-content">
                            <xsl:with-param name="node" select="../Manufacturer[position()+1]"/>
                        </xsl:call-template>
                    </td>
                <xsl:when>
            </xsl:choose>
        </xsl:for-each>
        </tr>
      </table>
    </xsl:template>
    </xsl:stylesheet>
    

    I’ve extracted the part that writes the content of the cells and the <xsl:choose> part from your example to another xsl:template called do-cell-content

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

Sidebar

Related Questions

I have an XSLT stylesheet that transforms an XML file to JSON format and
I have a .xslt that translates xml from one form to another (I'm not
I have an XML file that I am transforming via XSLT. I am passing
I have an xml document that I am transforming with xslt into an xsl-fo
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have an XSLT transform issue: style=width:{Data/PercentSpaceUsed}%; And the value of Data/PercentSpaceUsed is integer
I have created a xslt document which formats an xml document, but I would
I am transforming some XML data to fit into document that is in a
here is my below xml under that table due based on CTD_CTD_PKG_ID(some time under
i have to build an XSLT stylesheet that transforms an xml like this: <message>

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.