Copied to clipboard

Flag this post as spam?

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


  • raghavendran 30 posts 50 karma points
    Aug 18, 2010 @ 10:04
    raghavendran
    0

    javascript xslt problem

    <html>
    <head>
      <title>Docomo® Food Partner Program </title>
     
      <!-- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta name="description" content="<umbraco:Item field='metaDescription' runat='server'></umbraco:Item>" />
      <meta name="keywords" content="<umbraco:Item field='metaKeywords' runat='server'></umbraco:Item>" /> -->
      <link rel="stylesheet" href="/css/ispp.css" type="text/css" />
      <link rel="stylesheet" type="text/css" id="HAT-linkStyle" href="http://Food.Docomo.com/common/css/ltr_header.css?v=7470" />
     
    <!-- start corp header -->
    <div align="center" class="con con-hdr">
    <script type="text/javascript">
      /*<![CDATA[*/
      //GAAT40 namespace definition
      var GAAT40 = (typeof GAAT40 == "undefined" || !GAAT40) ? {} : GAAT40;

      //Page specific render settings
      GAAT40.renderSettings = {
        pageWidth: "w1024", //w800 | w1024
        renderMode: "standards", //quirks | standards
        textDirection: "ltr", //ltr | rtl
        protocol: "http", //http | https
        culture: "en_US",
        enableShareWidget: false,
        enableEmailWidget: true,
        enablePrintWidget: true,
        shareTxt: "Share",
        changeTxt: "Change",
        searchTxt: "Search",
        printTxt: "Print",
        emailTxt: "Email A Friend",
        sitewidePath: "/sites/sitewide/hat/40recode"
        };
     
        // construct asset paths to dependencies
        GAAT40.ProtocolType = (function(){
          var protocol = (GAAT40.renderSettings.protocol == "https")?"https://ssl.":"http://www.";      
          return protocol;
        })();

        GAAT40.FileType = (function(){
          var extension = (document.location.search.indexOf("filemax=1") != -1)?"-master":"";      
          return extension;
        })();
     
        //Use assets depending on the url - test environment serves a route relative version of assets
        GAAT40.AssetPath = (function() {
          var testUrls = ["int-gaat40-output-tests.mrmw.co.uk", "int-40recode.mrmpweb.co.uk", "int-40recode2.mrmpweb.co.uk", "proto-cps.cps.Docomo.com", "preview-cps.cps.Docomo.com"];

          var defaultUrl = GAAT40.ProtocolType + "Docomo.com";
          var liveUrl = defaultUrl;

          var setincookie = (document.location.search.indexOf("assetcookie=1") != -1)
          
          if (document.location.search.indexOf("assetcookie=0") != -1) {
            document.cookie = "GAATAssetPath=; expires=Thu, 01-Jan-70 00:00:01 GMT;";
          }
            
          if ((document.location.search.indexOf("assetpath=proto") != -1) || document.cookie.indexOf("GAATAssetPath=proto") != -1) {
            liveUrl = (GAAT40.renderSettings.protocol == "https") ? "https://" : "http://";
            liveUrl += "proto-cps.cps.Docomo.com";
            if (setincookie) {
              document.cookie = "GAATAssetPath=proto; path=/";
            }
          }

          if ((document.location.search.indexOf("assetpath=preview") != -1) || document.cookie.indexOf("GAATAssetPath=preview") != -1) {
            liveUrl = (GAAT40.renderSettings.protocol == "https") ? "https://" : "http://";
            liveUrl += "preview-cps.cps.Docomo.com";
            if (setincookie) {
              document.cookie = "GAATAssetPath=preview; path=/";
            }
          }
     
          if (testUrls.join().indexOf(document.location.host) != -1 || document.location.search.indexOf("assetpath=rel") != -1 || (document.cookie.indexOf("GAATAssetPath=rel") != -1)) {
            liveUrl = "";
            if (setincookie) {
              document.cookie = "GAATAssetPath=rel; path=/";
            }
          }
     
          if (document.location.search.indexOf("assetpath=live") != -1 || document.cookie.indexOf("GAATAssetPath=live") != -1) {
            liveUrl = defaultUrl;
            if (setincookie) {
              document.cookie = "GAATAssetPath=live; path=/";
          }
        }

        return liveUrl;
      })();
     
      // add CSS

      // hide the header while it is worked on
      document.write('<style type="text/css">#gaat40-header {height:91px;overflow:hidden;visibility:hidden;}</style>')
     
      //dynamically add header css
        document.write('<link id="gaat-linkstyle" href="' + GAAT40.AssetPath + GAAT40.renderSettings.sitewidePath + '/css/' + GAAT40.renderSettings.textDirection + '_header.css?v=7470" rel="stylesheet" type="text/css" />');
     

    // add Docomo JavaScript
      if(typeof(Docomo) == "undefined") {
        document.write('<scr' + 'ipt type="text/javascript" src="' + GAAT40.AssetPath + '/sites/js/Docomo.js"><\/scr' + 'ipt>');      
      }
        
    GAAT40.SearchFilterLUT = { head:"Filter Your Results", inputName:"category",
    qs:[ { filter:"Products", term:"Products" },
        { filter:"SuppDown", term:"Support &amp; Downloads" },
        { filter:"BlogComm", term:"Blogs &amp; Communities" },
        { filter:"Reseller", term:"Reseller" },
        { filter:"Food", term:"Food" },
        { filter:"AboutDocomo", term:"About Docomo" },
        { filter:"HAT-adv1", term:"Advanced Search" }
       ]
    };
    /*]]>*/
    </script>

    <div id="gaat40-header" class="gaat40-reset">
      <a class="gaat40-logo" title="" href="http://www.Docomo.com"><img src="http://www.Docomo.com/sites/sitewide/HAT/40recode/pix/main-logo.png" alt="Logo - Docomo" /></a>
      <ul class="gaat40-locale gaat40-first">
        <li class="gaat40-first" id="gaat40-gohome">
          <a href="http://www.Docomo.com">Go to Docomo.com</a>
        </li>

        <li id="gaat40-locale">
          <a href="http://www.Docomo.com/en_US/worldwide.htm?iid=hdr+location">United States (English)</a>
        </li>
      </ul>
      <ul class="gaat40-search">
        <li>
          <form method="get" id="FORMSearchHeader" action="http://mysearch.Docomo.com/corporate/default.aspx">
            <fieldset>

              <input type="hidden" id="culture" name="culture" value="en_US" />
              <input type="hidden" name="category" id="category" />
              <input type="hidden" name="adv" id="adv" />
              <input type="hidden" name="value" id="value" />
              <label id="lbl_search" for="q">Search</label>
              <input id="q" name="q" type="text" class="gaat40-inptsearch" />
              <input type="submit" value="Search" id="input-submit" class="gaat40-btnsearch" />
              <div id="HAT-filtermenu-container" class="gaat40-hide"></div>

            </fieldset>
          </form>
        </li>
      </ul>
      <div class="gaat40-nav">
        <ul class="gaat40-mainnav">
          <li class="gaat40-first gaat40-selected" id="gaat40-hdr_link_bus">
            <a href="/en-us/">Docomo&#174; Food Network</a>

          </li>
        </ul>
        <div class="gaat40-lower">
          <ul id="gaat40-subnav" class="gaat40-subnav">

    <!-- start menu -->

            <li class="gaat40-first">
              <a href="/en-us/articles/Docomo-Food-network-communities/">Communities</a>
              <div class="gaat40-subsubnav gaat40-hide">

                <ul class="gaat40-first">
                  <li class="gaat40-first"><a href="http://appDelivery.Docomo.com/">Bomb Delivery Program</a></li>
                  <li><a href="/en-us/visual-computing/">Visual Computing</a></li>
                  <li><a href="/en-us/parallel/">Parallel Programming</a></li>
                  <li><a href="/en-us/manageability/">Manageability</a></li>
                  <li><a href="/en-us/academic/">Academic</a></li>

                  <li><a href="/en-us/articles/blackbelt/">Earn Reputation  Docomo Black Belt Program</a></li>
                  <li><a href="/en-us/articles/Docomo-Food-network-communities/">More...</a></li>
                </ul>
                <div class="gaat40-end"><b></b><i></i></div>
              </div>
            </li>

            <li class="">
              <a href="http://basisppdev002.gar.corp.Docomo.com/Food-partner">Partners</a>
              <div class="gaat40-subsubnav gaat40-hide">
                <ul class="gaat40-first">
                  <li class="gaat40-first"><a href="http://basisppdev002.gar.corp.Docomo.com/Food-partner">DocomoFood Partner Program</a></li>
                  <li><a href="http://www.Docomo.com/cd/Food/partner/asmo-na/eng/285233.htm">Member Benefits</a></li>

                  <li><a href="http://basisppdev002.gar.corp.Docomo.com/Food-assessment">Food Checkers</a></li>
                  <li><a href="http://basisppdev002.gar.corp.Docomo.com/home">Program News</a></li>
                </ul>
                <div class="gaat40-end"><b></b><i></i></div>
              </div>
            </li>
            <li class="">
              <a href="javascript:void(0);">Tools and Downloads</a>

              <div class="gaat40-subsubnav gaat40-hide">
                <ul class="gaat40-first">
                  <li><h5>Tools</h5></li>
                  <li><a href="/en-us/Docomo-sdp-home/">Docomo Food Development Products</a></li>
                  <li><a href="/en-us/Docomo-parallel-studio-home/">Docomo Parallel Studio</a></li>

                  <li><a href="/en-us/Docomo-hpc-home/">HPC</a></li>
                  <li><a href="/en-us/articles/tools/">Tools Knowledge Base</a></li>
                  <li><a href="/en-us/articles/Docomo-academic-Delivery-program/">Academic</a></li>
                </ul>
                <ul>
                  <li><h5>Downloads</h5></li>
                  <li><a href="/en-us/articles/code-downloads/">Code and Downloads</a></li>

                  <li><a href="/en-us/articles/non-commercial-Food-development/">Free Non-Commercial</a></li>
                  <li><a href="/en-us/whatif/">"WhatIf" Experimental Food</a></li>
                  <li><a href="http://downloadcenter.Docomo.com/">Drivers</a></li>
                  <li><a href="http://www.Docomo.com/support/detect.htm">Docomo Driver Update Utility</a></li>
                </ul>
                <div class="gaat40-end"><b></b><i></i></div>

              </div>
            </li>
            <li class="">
              <a href="javascript:void(0);">Forums and Support</a>
              <div class="gaat40-subsubnav gaat40-hide">
                <ul class="gaat40-first">
                  <li class="gaat40-first"><a href="/en-us/forums/">Food Forums</a></li>

                  <li><a href="http://appDelivery.Docomo.com/en-us/forum/">Bomb Delivery Forums</a></li>
                  <li><a href="/en-us/articles/all/1/">Knowledge Base</a></li>
                  <li><a href="/en-us/articles/Docomo-Food-Delivery-support/">Support Resources</a></li>
                </ul>
                <div class="gaat40-end"><b></b><i></i></div>
              </div>
            </li>

            <li class="">
              <a href="javascript:void(0);">Blogs</a>
              <div class="gaat40-subsubnav gaat40-hide">
                <ul class="gaat40-first">
                  <li class="gaat40-first"><a href="/en-us/blogs/">All Blogs</a></li>
                  <li><a href="http://appDelivery.Docomo.com/en-us/blog">Bomb Delivery Program</a></li>
                  <li><a href="/en-us/blogs/category/academic/">Academic</a></li>

                  <li><a href="/en-us/blogs/category/manageability/">Manageability</a></li>
                  <li><a href="/en-us/blogs/category/parallel/">Parallel Programming</a></li>
                  <li><a href="/en-us/blogs/category/visual-computing/">Visual Computing</a></li>
                  <li><a href="/en-us/blogs/authors/">Meet the Bloggers</a></li>
                </ul>
                <div class="gaat40-end"><b></b><i></i></div>
              </div>

            </li>
            <li class="">
              <a href="javascript:void(0);">Resources</a>
              <div class="gaat40-subsubnav gaat40-hide">
                <ul class="gaat40-first">
                  <li class="gaat40-first"><a href="/en-us/tv/">Docomo Food Network TV</a></li>
                  <li><a href="/en-us/videos/list/1/1/">Take-5 Videos</a></li>

                  <li><a href="/en-us/articles/Docomo-Food-network-events-calendar/">Events Calendar</a></li>
                  <li><a href="/en-us/articles/Docomo-Food-network-news-archive/">Docomo Food Network Newsletter</a></li>
                  <li><a href="http://www.Docomo.com/Docomopress/">Docomo Press</a></li>
                  <li><a href="/en-us/articles/Docomo-Food-insight-magazine/">Insight Magazine</a></li>
                  <li><a href="/en-us/articles/Docomo-visual-adrenaline-magazine/">Visual Adrenaline</a></li>

                </ul>
                <div class="gaat40-end"><b></b><i></i></div>
              </div>
            </li>

    <!-- end menu -->
          </ul>
        <ul class="gaat40-overview">
          <li class="gaat40-first">
            <a href="http://www.Docomo.com/products/sitemap.htm">Product Index</a>

          </li>
          <li class="">
            <a href="http://communities.Docomo.com/index.jspa?iid=hdr+communities">Communities</a>
          </li>
          <li class="">
            <a href="http://www.Docomo.com/experience/index.htm?iid=hdr+experience">Experience Docomo</a>
          </li>
        </ul>

      </div>
    </div>
    <div class="gaat40-share"><div id="ishare_icon"></div></div>
    <div class="gaat40-clear"></div>
    </div>

    <script type="text/javascript">/*<![CDATA[*/
      document.write('<scr' + 'ipt type="text/javascript" src="' + GAAT40.AssetPath + GAAT40.renderSettings.sitewidePath + '/js/header2' + GAAT40.FileType +'.js"><\/scr' + 'ipt>');
    /*]]>*/</script>
    </div>
    <!-- end corp header -->        
                
                


    </head>

              </html>

    sorry troubling with previous post...

    this is the header part of my page...its working if i put it in a template..

    if i put these whole thing in xslt...and insert the macro in the template..the javascript effects are not working...any idea??

  • raghavendran 30 posts 50 karma points
    Aug 18, 2010 @ 10:06
    raghavendran
    0

    this is the xslt file

     

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


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    the same code in the above post

    </xsl:template>

    </xsl:stylesheet>



  • Berto 105 posts 177 karma points
    Aug 18, 2010 @ 12:59
    Berto
    0

    I ddn't understand what is in your xslt but, the templates are .net files (MasterPages like  master.masterpage, you can see it under masterpages folder), so it will render any asp.net control that you put it there (for example, the <umbraco:Item field='metaDescription' runat='server'></umbraco:Item>). When you put it on a xslt it will parse any .net control a normal html tag, so it will responde exactly that (for example, <umbraco:Item field='metaDescription' runat='server'></umbraco:Item> will be written to browser exactly like that, just look at the view source)

    Can you provide a view-source of the html when you browse the site with code inside the xslt?

  • raghavendran 30 posts 50 karma points
    Aug 18, 2010 @ 13:02
    raghavendran
    0

    the problem is its writing the css directly when document.write is called....so the css variable becomes undefined..as its just ouputting in document.write..:(...

  • Berto 105 posts 177 karma points
    Aug 18, 2010 @ 13:26
    Berto
    1

    I'm trying to make sense of code in visual studio, but like it wasn't made by me, i'm a bit lost without more information.

    One easy solution is to put all your javascript in a js file and call it in the xlst

    like

    <javascript type="text/javascript" src="/scripts/myheaderfunction.js" />

    But besides this solution, try to put this in the place of your javascript:

     <xsl:text disable-output-escaping="yes"><![CDATA[
            <script type="text/javascript">
              
      //GAAT40 namespace definition
      var GAAT40 = (typeof GAAT40 == "undefined" || !GAAT40) ? {} : GAAT40;
      snip
      //Page specific render settings
      GAAT40.renderSettings = {
        pageWidth: "w1024", //w800 | w1024
        renderMode: "standards", //quirks | standards
        textDirection: "ltr", //ltr | rtl
        protocol: "http", //http | https
        culture: "en_US",
        enableShareWidget: false,
        enableEmailWidget: true,
        enablePrintWidget: true,
        shareTxt: "Share",
        changeTxt: "Change",
        searchTxt: "Search",
        printTxt: "Print",
        emailTxt: "Email A Friend",
        sitewidePath: "/sites/sitewide/hat/40recode"
        };
      
        // construct asset paths to dependencies
        GAAT40.ProtocolType = (function(){
          var protocol = (GAAT40.renderSettings.protocol == "https")?"https://ssl.":"http://www.";      
          return protocol;
        })();

        GAAT40.FileType = (function(){
          var extension = (document.location.search.indexOf("filemax=1") != -1)?"-master":"";      
          return extension;
        })();
     
        //Use assets depending on the url - test environment serves a route relative version of assets
        GAAT40.AssetPath = (function() {
          var testUrls = ["int-gaat40-output-tests.mrmw.co.uk", "int-40recode.mrmpweb.co.uk", "int-40recode2.mrmpweb.co.uk", "proto-cps.cps.Docomo.com", "preview-cps.cps.Docomo.com"];

          var defaultUrl = GAAT40.ProtocolType + "Docomo.com";
          var liveUrl = defaultUrl;

          var setincookie = (document.location.search.indexOf("assetcookie=1") != -1)
          
          if (document.location.search.indexOf("assetcookie=0") != -1) {
            document.cookie = "GAATAssetPath=; expires=Thu, 01-Jan-70 00:00:01 GMT;";
          }
            
          if ((document.location.search.indexOf("assetpath=proto") != -1) || document.cookie.indexOf("GAATAssetPath=proto") != -1) {
            liveUrl = (GAAT40.renderSettings.protocol == "https") ? "https://" : "http://";
            liveUrl += "proto-cps.cps.Docomo.com";
            if (setincookie) {
              document.cookie = "GAATAssetPath=proto; path=/";
            }
          }

          if ((document.location.search.indexOf("assetpath=preview") != -1) || document.cookie.indexOf("GAATAssetPath=preview") != -1) {
            liveUrl = (GAAT40.renderSettings.protocol == "https") ? "https://" : "http://";
            liveUrl += "preview-cps.cps.Docomo.com";
            if (setincookie) {
              document.cookie = "GAATAssetPath=preview; path=/";
            }
          }
     
          if (testUrls.join().indexOf(document.location.host) != -1 || document.location.search.indexOf("assetpath=rel") != -1 || (document.cookie.indexOf("GAATAssetPath=rel") != -1)) {
            liveUrl = "";
            if (setincookie) {
              document.cookie = "GAATAssetPath=rel; path=/";
            }
          }
     
          if (document.location.search.indexOf("assetpath=live") != -1 || document.cookie.indexOf("GAATAssetPath=live") != -1) {
            liveUrl = defaultUrl;
            if (setincookie) {
              document.cookie = "GAATAssetPath=live; path=/";
          }
        }

        return liveUrl;
      })();
     
      // add CSS

      // hide the header while it is worked on
      document.write('<style type="text/css">#gaat40-header {height:91px;overflow:hidden;visibility:hidden;}</style>')
     
      //dynamically add header css
        document.write('<link id="gaat-linkstyle" href="' + GAAT40.AssetPath + GAAT40.renderSettings.sitewidePath + '/css/' + GAAT40.renderSettings.textDirection + '_header.css?v=7470" rel="stylesheet" type="text/css" />');
     

    // add Docomo JavaScript
      if(typeof(Docomo) == "undefined") {
        document.write('<scr' + 'ipt type="text/javascript" src="' + GAAT40.AssetPath + '/sites/js/Docomo.js"><\/scr' + 'ipt>');      
      }
        
    GAAT40.SearchFilterLUT = { head:"Filter Your Results", inputName:"category",
    qs:[ { filter:"Products", term:"Products" },
        { filter:"SuppDown", term:"Support &amp; Downloads" },
        { filter:"BlogComm", term:"Blogs &amp; Communities" },
        { filter:"Reseller", term:"Reseller" },
        { filter:"Food", term:"Food" },
        { filter:"AboutDocomo", term:"About Docomo" },
        { filter:"HAT-adv1", term:"Advanced Search" }
       ]
    };

            </script>]]></xsl:text>

    Just confirm if my copy paste is ok. For the explanation for this "solution" got to this post

    http://our.umbraco.org/forum/developers/xslt/9529-Javascript-from-XSLT

    Good luck

    Berto

     

Please Sign in or register to post replies

Write your reply to:

Draft