Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Need to produce the output in 2 rows and 3 columns

$
0
0

I am customizing CQWP in itemstyle.xsl creating Template. 

Here is the code am not getting the output.. it is displaying the value in single column..

<xsl:template name="News" match="Row[@Style='News']" mode="itemstyle">
    <xsl:param name="CurPos" />
    <xsl:param name="LastRow" />
    <xsl:variable name="SafeLinkUrl">
      <xsl:call-template name="OuterTemplate.GetSafeLink">
        <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="SafeImageUrl">
      <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
        <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="DisplayTitle">
      <xsl:call-template name="OuterTemplate.GetTitle">
        <xsl:with-param name="Title" select="@Title"/>
        <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="LinkTarget">
      <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>
    </xsl:variable>

    <xsl:variable name="ColNum">3</xsl:variable>

    <xsl:if test="$CurPos = 1 ">
      <xsl:text disable-output-escaping="yes">&lt;div&gt;&lt;table&gt;</xsl:text>
    </xsl:if>
    <xsl:if test="$CurPos mod $ColNum = 1">
      <xsl:text disable-output-escaping="yes">&lt;tr&gt;</xsl:text>
    </xsl:if>


    <td valign="top">
      <xsl:attribute name="width">
        <xsl:value-of select="round(100 div $ColNum) + '%'" />
      </xsl:attribute>
      <table width="90%">
        <tr height="27px" valign="top">
          <td>
            <span>
              <a href="{$SafeLinkUrl}">
                <xsl:value-of select="$DisplayTitle"/>
              </a>
            </span>
            <span>
              <xsl:value-of select="ddwrt:FormatDateTime(@ArticleStartDate, 1033, 'MM-dd-yyyy')"/>
            </span>
          </td>
        </tr>
        <tr height="35px" min-height="35px" valign="top">
          <td>
            <span>
              <xsl:if test="string-length($SafeImageUrl) != 0">
                <div class="image-area-left">
                  <a href="{$SafeLinkUrl}" target="{$LinkTarget}">
                    <img class="image" width="100px" height="100px" src="{$SafeImageUrl}" alt="{@ImageUrlAltText}" />
                  </a>
                </div>
              </xsl:if>
              <xsl:value-of select="substring(@Comments,0,200)" disable-output-escaping="yes"/>
              <xsl:if test="string-length(@Comments) &gt; 200">…</xsl:if>
            </span>
            <a href="{$SafeLinkUrl}"> Details…</a>
          </td>
        </tr>

      </table>
    </td>

    <xsl:if test="$CurPos mod $ColNum = 0">
      <xsl:text disable-output-escaping="yes">&lt;/tr&gt;</xsl:text>
    </xsl:if>
    <xsl:if test="$CurPos = $LastRow ">
      <xsl:text disable-output-escaping="yes">&lt;/table&gt;&lt;/div&gt;</xsl:text>
    </xsl:if>
  </xsl:template>



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>