Copied to clipboard

Flag this post as spam?

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


  • Rik Helsen 670 posts 873 karma points
    Aug 30, 2010 @ 09:31
    Rik Helsen
    0

    XSLT doesn't return results untill I refresh the page?

    I ran into this behavious with 4.5.2 today, where a page containing an XSLT macro only returned partial results, and then after I refreshed the page it showed the correct output.

    This is the output on first pageload:

                        <div id="jobs">
    <div class="jobheader">
    </div>
    </div>

    This on second pageload:

    <ul class="joboverview"><li class="joboverviewcountry"><h2>Aviapartner
                    Belgium:
                    Brussels (BRU)</h2></li><ul><li><a href="/en/jobs/station-manager-international-projects">Station Manager / International Projects</a></li><li><a href="/en/jobs/assistant-airside-manager">Assistant Airside Manager</a></li><li><a href="/en/jobs/preventie-adviseur-niveau-1">Preventie-adviseur </a></li><li><a href="/en/jobs/trainer-dangerous-goods">Trainer dangerous goods</a></li><li><a href="/en/jobs/accountant-general-ledger">Accountant General Ledger </a></li><li><a href="/en/jobs/check-in-bediende-(20h)">Check-in bediende (20h)</a></li><li><a href="/en/jobs/assistant-airside-manager">Assistant airside manager</a></li><li><a href="/en/jobs/arbeider-luchthaven-(30h)">Arbeider luchthaven (30h)</a></li><li><a href="/en/jobs/duty-supervisor-cargo">Duty supervisor cargo</a></li><li><a href="/en/jobs/maintenance-manager">Maintenance manager</a></li></ul><li class="joboverviewcountry"><h2>Aviapartner
                    Germany:
                    Cologne (CGN)</h2></li><ul><li><a href="/en/jobs/ramp-agent-koordinator-(mw)-in-teilzeit-in-koeln">Ramp agent-koordinator (m/w) in teilzeit in koeln</a></li><li><a href="/en/jobs/mitarbeiter-flugzeugabfertigung-(mw)-in-teilzeit-in-koeln">Mitarbeiter flugzeugabfertigung (m/w) in teilzeit in koeln</a></li><li><a href="/en/jobs/mitarbeiter-in-luftfrachtabfertigung-(mw)">Mitarbeiter/-in luftfrachtabfertigung (m/w)</a></li></ul><li class="joboverviewcountry"><h2>Aviapartner
                    Germany:
                    Düsseldorf (DUS)</h2></li><ul><li><a href="/en/jobs/mitarbeiter-lost-and-found-(mw)-(vollzeit)">Mitarbeiter lost and found (m/w) (vollzeit) </a></li><li><a href="/en/jobs/mitarbeiter-loadcontrol-(mw)-(vollzeit)">Mitarbeiter loadcontrol (m/w) (vollzeit)</a></li><li><a href="/en/jobs/mitarbeiter-in-der-flugzeug-passagierabfertigung-(mw)">Mitarbeiter in der flugzeug-/passagierabfertigung (m/w)</a></li><li><a href="/en/jobs/studentische-aushilfe-(mw)-in-der-flugzeugabfertigung">Studentische aushilfe (m/w) in der flugzeugabfertigung</a></li><li><a href="/en/jobs/mitarbeiter-gepaeckabfertigung-(mw)-in-teilzeit">Mitarbeiter gepaeckabfertigung (m/w) in teilzeit</a></li><li><a href="/en/jobs/mitarbeiter-flugzeugabfertigung-(mw)-in-teilzeit">Mitarbeiter flugzeugabfertigung (m/w) in teilzeit</a></li></ul><li class="joboverviewcountry"><h2>Aviapartner
                    Germany:
                    Frankfurt (FRA)</h2></li><ul><li><a href="/en/jobs/mitarbeiter-in-luftfrachtabfertigung">Mitarbeiter/-in luftfrachtabfertigung (m/w) </a></li><li><a href="/en/jobs/sachbearbeiter-in-export">Sachbearbeiter/-in export (m/w)</a></li></ul><li class="joboverviewcountry"><h2>Aviapartner
                    Germany:
                    Munich (MUC)</h2></li><ul><li><a href="/en/jobs/assistent-in-des-stationsleiters-muenchen">Assistent/-in des stationsleiters muenchen </a></li><li><a href="/en/jobs/fahrer-in-hon-service-muenchen-in-teilzeit">Fahrer/-in hon-service muenchen in teilzeit</a></li><li><a href="/en/jobs/mitarbeiter-gepaeckabfertigung-(mw)-in-teilzeit">Mitarbeiter gepaeckabfertigung (m/w) in teilzeit</a></li><li><a href="/en/jobs/mitarbeiter-flugzeugabfertigung-(mw)-in-teilzeit">Mitarbeiter flugzeugabfertigung (m/w) in teilzeit </a></li></ul><li class="joboverviewcountry"><h2>Aviapartner
                    Netherlands:
                    Amsterdam (AMS)</h2></li><ul><li><a href="/en/jobs/allround-medewerker-ramp-(30-uurweek)">Allround medewerker ramp</a></li><li><a href="/en/jobs/medewerker-flightdispatch">Medewerker flightdispatch (op oproepbasis)</a></li><li><a href="/en/jobs/allround-medewerker-met-pushback">Allround medewerker met pushback</a></li><li><a href="/en/jobs/loading-supervisor">Loading supervisor</a></li></ul></ul>

    Has anyone noticed such behaviour ? I quite dislike the idea of the visitors of the website running into blank pages ...

    The xslt that doesn't always output:

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

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

    <xsl:param name="currentPage"/>

    <!-- Don't change this, but add a 'contentPicker' element to -->
    <!-- your macro with an alias named 'source' -->
    <xsl:variable name="source" select="1121"/>
    <xsl:template match="/">
    <!-- The fun starts here -->
      <ul class="joboverview">
        <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
            <xsl:if test="count(current()/child::* [@isDoc]) &gt; 0 ">
              <xsl:for-each select="./child::* [@isDoc and string(umbracoNaviHide) != '1']">
                <xsl:if test="count(umbraco.library:GetXmlNodeById(1127)/* [@isDoc and relatedAirport= current()/@id ])">
                  <li class="joboverviewcountry"><h2>Aviapartner
                    <xsl:value-of select="./../@nodeName"/>:
                    <xsl:value-of select="@nodeName"/></h2>
                  </li>
                  <!-- use current nodeid to look in jobs where nodeid matches relatedAirport -->
                    <ul>
                      <xsl:for-each select="umbraco.library:GetXmlNodeById(1127)/* [@isDoc and relatedAirport= current()/@id and string(umbracoNaviHide) != '1']">
                        <li>
                          <a href="{umbraco.library:NiceUrl(./@id)}">
                            
                            <xsl:value-of select="./navTitle"/>
                         
                          </a>
                        </li>
                      </xsl:for-each>
                    </ul>
                  </xsl:if>
                </xsl:for-each>
              </xsl:if>
            </xsl:for-each>
          </ul>
    </xsl:template>

    </xsl:stylesheet>
  • Rick 2 posts 22 karma points
    Mar 02, 2011 @ 03:43
    Rick
    0

    I have this same problem, right now. It's bugging me. No pun intended. Did you ever figure this out?

  • Rik Helsen 670 posts 873 karma points
    Mar 08, 2011 @ 10:46
    Rik Helsen
    0

    it's been a very long time :p

    don't quite remember how i fixed it, here is the current xslt for this macro:

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

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

    <xsl:param name="currentPage"/>

    <!-- Don't change this, but add a
    'contentPicker' element to -->

    <!--
    your macro with an alias named 'source' -->

    <xsl:variable
    name="source" select="1121"/>
    <xsl:template
    match="/">
    <xsl:variable name="querystring"
    select="umbraco.library:RequestQueryString('filter')"/>


    <xsl:choose>
    <xsl:when test="umbraco.library:RequestQueryString('filter')
    != ''"
    >
      <!-- List only
    jobs for querystring -->

      
     Currently showing
    only jobs for
    <strong><xsl:value-of
    select="umbraco.library:RequestQueryString('filter')"/></strong>. <strong><a href="/en/jobs">View all jobs</a></strong>.
      
      <ul class="joboverview">
        <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/*
    [@isDoc and string(umbracoNaviHide) != '1' and string(@nodeName) =
    $querystring]"
    >
        
            <xsl:if test="count(current()/child::* [@isDoc]) &gt; 0 ">
           
      
    <xsl:for-each select="./child::*
    [@isDoc and string(umbracoNaviHide) != '1']"
    >
             
      
    <xsl:if test="count(umbraco.library:GetXmlNodeById(1127)/*
    [@isDoc and relatedAirport= current()/@id ])"
    >
             
        
    <li class="joboverviewcountry"><h2>Aviapartner
           
            
    <xsl:value-of select="./../@nodeName"/>:
                    <xsl:value-of select="@nodeName"/></h2>
                  </li>
                  <!--
    use current nodeid to look in jobs where nodeid matches relatedAirport
    -->

                    <ul>
           
              
    <xsl:for-each select="umbraco.library:GetXmlNodeById(1127)/*
    [@isDoc and relatedAirport= current()/@id and string(umbracoNaviHide)
    != '1']"
    >
                        <li>
           
                  
    <a href="{umbraco.library:NiceUrl(./@id)}">
           
                    

                       
        
    <xsl:value-of select="./navTitle"/>
           
                 

                          </a>
           
                
    </li>
                      </xsl:for-each>
           
            
    </ul>
                  </xsl:if>
                </xsl:for-each>
              </xsl:if>
            </xsl:for-each>
          </ul>
      
      
      
      
      
    </xsl:when>

      
      
      
      
      <xsl:otherwise>
      <!-- List all
    jobs, no filter applies -->

      <ul class="joboverview">
        <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/*
    [@isDoc and string(umbracoNaviHide) != '1']"
    >
        
            <xsl:if test="count(current()/child::*
    [@isDoc]) &gt; 0 "
    >
              <xsl:for-each select="./child::*
    [@isDoc and string(umbracoNaviHide) != '1']"
    >
             
      
    <xsl:if test="count(umbraco.library:GetXmlNodeById(1127)/*
    [@isDoc and relatedAirport= current()/@id ])"
    >
             
        
    <li class="joboverviewcountry"><h2>Aviapartner
           
            
    <xsl:value-of select="./../@nodeName"/>:
                    <xsl:value-of select="@nodeName"/></h2>
                  </li>
                  <!--
    use current nodeid to look in jobs where nodeid matches relatedAirport
    -->

                    <ul>
           
              
    <xsl:for-each select="umbraco.library:GetXmlNodeById(1127)/*
    [@isDoc and relatedAirport= current()/@id and string(umbracoNaviHide)
    != '1']"
    >
                        <li>
           
                  
    <a href="{umbraco.library:NiceUrl(./@id)}">
           
                    

                       
        
    <xsl:value-of select="./navTitle"/>
           
                 

                          </a>
           
                
    </li>
                      </xsl:for-each>
           
            
    </ul>
                  </xsl:if>
                </xsl:for-each>
              </xsl:if>
            </xsl:for-each>
          </ul>
    </xsl:otherwise>
    </xsl:choose>



    </xsl:template>

    </xsl:stylesheet>

     

Please Sign in or register to post replies

Write your reply to:

Draft