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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:24:40+00:00 2026-06-16T13:24:40+00:00

I am using the following XSLT: https://gist.github.com/4402884 Where the following template does the transformation

  • 0

I am using the following XSLT:

https://gist.github.com/4402884

Where the following template does the transformation to render html output as follows:

<li>
  <div class="content-left" style="float:left; width:300px"> content </div>

  <div class="content-left" style="float:left; width:300px">content </div>
</li>

<li>
  <div class="content-left" style="float:left; width:300px"> content </div>

  <div class="content-left" style="float:left; width:300px">content </div>
</li>
.
.
.

so on..
Actual XSLT doing the job to get the two column layout like this:

A-----B
C-----D
E-----F

where each row is an ‘li’ item

 <xsl:choose>
    <xsl:when test="$CurPos mod 2 =1">
       <xsl:text disable-output-escaping="yes">&lt;li style=&quot;width:610px; height:290px; &quot;&gt;</xsl:text>      
       <div class="content-left" style="width:290px; height:290px;float:left;">
            <xsl:value-of select="@PublishingRollupImage" disable-output-escaping="yes" />
            <span class="NewsHeading"><h4><xsl:value-of select="$CurPos"/><xsl:value-of select="@Title"/></h4></span>
            <span class="Desc" style="display:block; width:280px;"><xsl:value-of select="substring(@Comments,0,200)"/>
            <xsl:if test="string-length(@Comments) &gt; 200">…</xsl:if><a href="{$SafeLinkUrl}" class="ReadMore"> Read More</a></span>
        </div>

        <div class="content-right" style="float:right; width:290px; height:290px;">
            <xsl:if test="$CurPos != $LastRow ">
                <xsl:value-of select="following-sibling::*[1]/@PublishingRollupImage" disable-output-escaping="yes" />
                <span class="NewsHeading"><h4><xsl:value-of select="$LastRow"/><xsl:value-of select="following-sibling::*[1]/@Title"/></h4></span>
                <span class="Desc" style="display:block; width:280px;"><xsl:value-of select="substring(following-sibling::*[1]/@Comments,0,200)"/>
                <xsl:if test="string-length(following-sibling::*[1]/@Comments) &gt; 200">…</xsl:if>
                <a href="{$SibSafeLinkUrl}" class="ReadMore"> Read More</a></span>
            </xsl:if>
        </div>
    </xsl:when> 
    <xsl:otherwise>
         <xsl:text disable-output-escaping="yes">&lt;/li&gt;</xsl:text>
    </xsl:otherwise>
</xsl:choose>

Sadly, however Inernet Explorer produces unnecessary self-closed tags like this(just IE), FF and chrome render it correctly…

<li>
  <div class="content-left" style="float:left; width:300px"> content </div>

  <div class="content-left" style="float:left; width:300px">content </div>
</li></li/></li/>

<li>
  <div class="content-left" style="float:left; width:300px"> content </div>

  <div class="content-left" style="float:left; width:300px">content </div>
</li></li/></li/>

How do I get rid of those unwanted self-closed weird looking ‘li’ tags? Because i need the exact html structure for a jquery slider plugin to work, because of the unwanted tags, slider is misbehaving.

This is in IE:
IE http://www.imagesup.net/?di=9135673644516

This is in FireFox:
FF http://www.imagesup.net/?di=11135673652612

  • 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-16T13:24:42+00:00Added an answer on June 16, 2026 at 1:24 pm

    I am not sure this will solve your problem, but I would strongly consider re-jigging your xsl:choose statement. I am guessing you are using disable-output-escaping because if you tried to write your XSLT like the following sample, it would not be well-formed XML, and so not valid. (I’ve abridged the code sample for brevity).

    <xsl:choose>
        <xsl:when test="$CurPos mod 2 =1">
           <li>  
           <div class="content-left">
               <xsl:value-of select="@PublishingRollupImage" />
            </div>
            <div class="content-right">
               <xsl:value-of select="following-sibling::*[1]/@PublishingRollupImage" />
            </div>
        </xsl:when> 
        <xsl:otherwise>
             </li>
        </xsl:otherwise>
    </xsl:choose>
    

    What you are trying to achieve is to group together pairs of element, so you select the elements in position 1, 3, 5, etc. and then output that element and the following one.

    What you could do instead, to avoid the use of disable-output-escaping, is to re-write it like this.

    <xsl:if test="$CurPos mod 2 =1">
       <li>  
          <div class="content-left">
             <xsl:value-of select="@PublishingRollupImage" />
          </div>
          <div class="content-right">
             <xsl:value-of select="following-sibling::*[1]/@PublishingRollupImage" />
          </div>
       </li>
    </xsl:if>
    

    This is now well-formed, and the li elements are being output directly. Whether this solves your problem or not, it is probably worth doing.

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

Sidebar

Related Questions

I am trying to remove the attribute xmlns=http://webdev2003.test.com from the following xml using xsl/xslt,
I have the following: <Data xmlns:x=Namespace.com> <Node></Node> <Node2></Node2> <Node3></Node3> </Data> How using XSLT can
I am following the tutorial here: http://www.aspfree.com/c/a/XML/Applying-XSLT-to-XML-Using-ASP.NET/2/ The tutorial shows how one converts xml
I'm trying to query an xml file using the following xslt: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
I'm trying to apply an xlst transformation using the following file. This is very
How can I convert the following XML to an escaped text using XSLT? Source:
I'm using XSLT and need to generate the doctype dynamically in the transformed output,
I used the below code to display a XML file as HTML using XSLT
Whi is it that the output of the following XSLT's xsl:copy-of is this (I
I'm transforming xml using the following code. It works fine for one xslt but

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.