Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mohammad Azeem 31 posts 74 karma points
    Jul 11, 2012 @ 17:17
    Mohammad Azeem
    0

    I dont want to Repeat Macro in Content Pages for my News.XSLT

    Hi!
    I created a XSLT in my Web for News List.. and i added it into Master Template... it shows in all the content pages.. i dont to want this...
    my XSLT code is here
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:umbraco.contour="urn:umbraco.contour" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour tagsLib BlogLibrary ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- The fun starts here-->

    <div class="news">
      <marquee behavior="scroll" scrollamount="2"  direction="up">
    <!--<xsl:variable name="newsNode" select="$currentPage/ancestor::root/HospitalNews [@isDoc]" /> -->

      <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide1) != '1']">
      <xsl:sort select="@updateDate" order="ascending" />
       <h3 class="headline"> 
          <xsl:value-of select="@nodeName"/>
      
    </h3>
    <small class="meta">Posted: <xsl:value-of select="umbraco.library:LongDate(@updateDate, true(), ' - ')"/></small><br/>
     <!--  <p class="introduction">-->
        <xsl:value-of select="umbraco.library:ReplaceLineBreaks(NewsArticle)" disable-output-escaping="yes"/>
      <!-- </p>-->
     </xsl:for-each>
      </marquee>
      </div>

    </xsl:template>

    </xsl:stylesheet>

     

    I used this Macro in Master Templete ..in this way..
    <div style="float: right; width: 25%;">
    <umbraco:Macro Alias="umbNewsListItems" runat="server"></umbraco:Macro>
    </div>

     

     

    if any Suggestions:

    Thanks in Advance


  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jul 11, 2012 @ 22:29
    Chriztian Steinmeier
    0

    Hi Azeem,

    One way to do this would be to create a template that inherits from your Master, and create a placeholder in the Master. Put the macro inside the new template and only assign that template to the page(s) where you want the marquee (!) to show.

    Otherwise, here's how you can limit the execution of the macro only to specific pages:

    The highlighted if statement is where you add the condition - you can do lots of different stuff there - let me know if you need help in your specific case. 

    <xsl:template match="/">
        <xsl:if test="$currentPage[@id = XXXX]">
            <div class="news">
                <marquee behavior="scroll" scrollamount="2"  direction="up">
                <!--<xsl:variable name="newsNode" select="$currentPage/ancestor::root/HospitalNews [@isDoc]" /> -->
                    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide1) != '1']">
                        <xsl:sort select="@updateDate" order="ascending" />
                        <h3 class="headline"> 
                            <xsl:value-of select="@nodeName"/>
                        </h3>
                        <small class="meta">Posted: <xsl:value-of select="umbraco.library:LongDate(@updateDate, true(), ' - ')"/></small><br/>
                        <!--  <p class="introduction">-->
                        <xsl:value-of select="umbraco.library:ReplaceLineBreaks(NewsArticle)" disable-output-escaping="yes"/>
                        <!-- </p>-->
                    </xsl:for-each>
                </marquee>
            </div>
        </xsl:if>
    </xsl:template>

    /Chriztian

  • Mohammad Azeem 31 posts 74 karma points
    Jul 12, 2012 @ 08:28
    Mohammad Azeem
    0

    Hi! Chriztian

    if i added this line of code that you highlighted in XSLT add put id number of page... it shows error and XSLT even not saved

    Thanks for your suggestion
    Azeem Raavi

  • Mohammad Azeem 31 posts 74 karma points
    Jul 12, 2012 @ 09:08
    Mohammad Azeem
    0

    i also creat a new template.. and use it.. but issue not resolved

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jul 12, 2012 @ 22:44
    Chriztian Steinmeier
    0

    Hi Azeem,

    Did you remember the closing </xsl:if> also (second-to-last line)? I didn't highlight it, so maybe you missed it...

    That would explain the XSLT error...

    /Chriztian

  • Mohammad Azeem 31 posts 74 karma points
    Jul 13, 2012 @ 09:49
    Mohammad Azeem
    0

    Hi Chriztian!
    Thanks for your kind suggestions....
    actually am newbie in Umbraco... however i solved problem to another another way...
    yes i closed the node.....</xsl:if>...
    Your solution was correct but problem was in my doc types...
    again Thanks

    Cheers: Azeem ravi

    I would like intouch with you in future
    skype Name: azeemravi361

Please Sign in or register to post replies

Write your reply to:

Draft