Showing posts with label Content Query. Show all posts
Showing posts with label Content Query. Show all posts

Saturday, October 20, 2012

XSL Read More and Full Data Content Query

 

Edit in ItemStyle.xsl


  <xsl:template name="FullData" match="Row[@Style='FullData']" mode="itemstyle">
   <xsl:variable name="SafeLinkUrl">
                     <xsl:call-template name="OuterTemplate.GetSafeLink">
                           <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
                           <xsl:with-param name="UseFileName" select="1"/>
                     </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:value-of select="@Body" disable-output-escaping="yes"/>
<div align="right" style="color:black;">                  
  <input type="button" onclick="test('dsf');" value="Close"></input>  </div>

 

<SCRIPT language="JavaScript"><![CDATA[
            function test(avalue) {
               var url = location.search;
               var getIndex = url.indexOf("Source=");
               var getUrl=url.substring(getIndex,url.length).replace("Source=","");
window.location = decodeURIComponent(getUrl);
              
            }
      ]]></SCRIPT> 

       </xsl:template>

 
 
 
  <xsl:template name="ReadMore" match="Row[@Style='ReadMore']" mode="itemstyle">
 
 
   <xsl:variable name="SafeLinkUrl">
                     <xsl:call-template name="OuterTemplate.GetSafeLink">
                           <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
                           <xsl:with-param name="UseFileName" select="1"/>
                     </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:value-of select="concat(substring(@Body,0,500),'...')" disable-output-escaping="yes"/>
<div align="right" style="color:black">                     <a href="{$SafeLinkUrl}">Read more</a></div>
            

       </xsl:template>