Copied to clipboard

Flag this post as spam?

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


  • Amir 75 posts 224 karma points
    Aug 23, 2012 @ 15:25
    Amir
    0

    Calling XSLT file from masterpage return nothing!!

    Hi Guys,

    After a while I started using again Umbraco(this time 4.8) for a customer of mine.

    I faced a very basic problem which is killing me!!!

    I want to simply call one of my XSLT files in a template (MasterPage) but by calling it, i see nothing in the outcome.

    Any idea what am i missing here?

    I am using VS2010.

    the outcome is a blank page and in the page source what I see is:

    
     <!DOCTYPE html>
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>
    
        </title>
        <link rel="stylesheet" href="/CSS/style.css" type="text/css" />
    
        <!--[if lt IE 9]>
                        <script src="/assets/js/html5.js"></script>
                        <link rel="stylesheet" type="text/css" href="/css/ie.css" />
              <script src="/assets/js/IE8.js"></script>
                    <![endif]-->
    
        </head>
    
        <body>
    
        <form method="post" action="/home.aspx" id="aspnetForm">
    <div class="aspNetHidden">
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUENTM4MWRkL1V6mgTssukwI728ssxCvZDFBxw5JjzfA4eXYEM1oLg=" />
    </div>
            <div id="content-wrapper">
            
            <div id="MiddleItems">
                <div id="Boxes">
    
                </div>
            </div>
            </div>
        </form>
        </body>
        </html>
    

     

    Please find below my codes:

    XSLT File: (name= HomePageMiddleItems.xslt)

     

    <?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:autofolders.library="urn:autofolders.library"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets autofolders.library ">

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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

        <div class="list-grid">
            <xsl:if test="string-length($currentPage/ancestor-or-self::Website/HomePage/middleItems) > 0">
                <xsl:variable name="middleitems" select="umbraco.library:Split($currentPage/ancestor-or-self::Website/HomePage/middleItems,',')"/>
                <xsl:for-each select="$middleitems//values">
                    <dl>
                        <a>
                            <xsl:variable name="myNode" select="umbraco.library:GetXmlNodeById(current())"/>
                            <xsl:attribute name="href">
                                <xsl:value-of select="umbraco.library:NiceUrl($myNode/@id)"/>
                            </xsl:attribute>
                            <xsl:attribute name="src">
                                <xsl:value-of select="umbraco.library:GetMedia($myNode/@id, 0)/data [@alias = 'image']"/>
                            </xsl:attribute>
                            <xsl:value-of select="$myNode/@linkText"/>
                        </a>
                    </dl>
                </xsl:for-each>
            </xsl:if>
        </div>

    </xsl:template>

    </xsl:stylesheet>

    Masterpage:

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.Master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
     <!DOCTYPE html>
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>
       
        </title>
        <link rel="stylesheet" href="/CSS/style.css" type="text/css" />

        <!--[if lt IE 9]>
                        <script src="/assets/js/html5.js"></script>
                        <link rel="stylesheet" type="text/css" href="/css/ie.css" />
              <script src="/assets/js/IE8.js"></script>
                    <![endif]-->

        </head>
       
        <body>
      
        <form runat="server" id="aspnetForm">
            <div id="wrapper">
            </div>
            <div id="content-wrapper">
            <div id="underBanner">
            </div>
            <div id="MiddleItems">
                <div id="Boxes">
                    <umbraco:macro Alias="HomePageMiddleItems" runat="server"/>
                </div>
            </div>
            </div>
        </form>
        </body>
        </html>
    </asp:Content>
  • Amir 75 posts 224 karma points
    Aug 23, 2012 @ 15:33
    Amir
    0

    Update:

    while I am working in VS on my masterpage, sounds my VS is not recognizing the "umbraco:macro" tag as there is a green line under it!

    Could it be any how related to my problem?

    .........

     

  • Amir 75 posts 224 karma points
    Aug 23, 2012 @ 17:27
    Amir
    0

    lol,

    Stupid question right?

    I totally forgot about the Macros!!!!!!!!!

Please Sign in or register to post replies

Write your reply to:

Draft