Copied to clipboard

Flag this post as spam?

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


  • Jakob 38 posts 54 karma points
    Jul 24, 2009 @ 01:01
    Jakob
    0

    Recursive call causes trouble

    I Know this is a really shitty (excuse my french) post, so please bear with me and I will try to do as you tell me to make it easier for me to benefit from your help. My problem is that I'm only recieving an Error parsing xslt error. I will post my code and then explain a bit further.

     

    My code looks like this. God bless you, if you read through it all.

    <?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"/>


    <xsl:variable name="startdate" select="umbraco.library:RequestQueryString('startdate')" />
    <xsl:variable name="enddate" select="umbraco.library:RequestQueryString('enddate')" />
    <xsl:variable name="solution" select="umbraco.library:RequestQueryString('solution')" />
    <xsl:variable name="playlist" select="umbraco.library:RequestQueryString('playlist')" />

    <xsl:template match="/">
    <xsl:value-of select="$startdate" />
    <xsl:value-of select="$enddate" />
    <xsl:value-of select="$solution" />
    <xsl:value-of select="$playlist" />
    <xsl:value-of select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/@createDate"/>
    <slots>
    <slot id="slot1" starttime="{umbraco.library:RequestQueryString('startdate')}" endtime="{umbraco.library:RequestQueryString('enddate')}">
    <xsl:apply-templates select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($startdate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan(./data[@alias='EndDate'],$enddate) or (umbraco.library:ShortTime($startdate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)))][1]" mode="playlistItems">
    <xsl:with-param name="playlistDate" select="$startdate" />
    <xsl:with-param name="listedids" select="0" />
    </xsl:apply-templates>
    </slot>
    </slots>
    </xsl:template>

    <xsl:template name="playlistItem" match="node" mode="playlistItems">
    <xsl:param name="playlistDate" />
    <xsl:param name="listedids" />
    <xsl:apply-templates select=".">
    <!-- DURATION -->    
    <xsl:with-param name="duration">
    <xsl:if test="data[@alias='Duration']=''">0</xsl:if>
    <xsl:value-of select="./data[@alias='Duration']" />
    </xsl:with-param>

    <!-- SOUND -->
    <xsl:with-param name="sound">
    <xsl:if test="./data[@alias='Sound']='0'">Off</xsl:if>
    <xsl:if test="./data[@alias='Sound']='1'">On</xsl:if>
    </xsl:with-param>

    <!-- JAVASCRIPT -->
    <xsl:with-param name="javascript">
    <xsl:if test="./data[@alias='javascript']=''">Not_Set</xsl:if>
    <xsl:value-of select="./data[@alias='javascript']" />
    </xsl:with-param>
    </xsl:apply-templates>

    <!-- recursive call starts here -->
    <xsl:if test="umbraco.library:DateGreaterThan($enddate, $playlistDate)">
    <xsl:choose>
    <xsl:when test="count($currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($startdate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan(./data[@alias='EndDate'],$enddate) or (umbraco.library:ShortTime($playlistDate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)) or contains($listedids, '|' + @id + '|'))]) = 0">
    <!--     check1: startdate, enddate, starttime and endtime within current playlisttime and endtime, check2: nextid not already displayed (not within listedids)-->
    <xsl:apply-templates select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($playlistDate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan(./data[@alias='EndDate'],$enddate) or (umbraco.library:ShortTime($playlistDate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)))][1]" mode="playlistItems">
    <xsl:with-param name="playlistDate" select="umbraco.library:DateAdd($playlistDate,ms,data[@alias='Duration'])" />
    <xsl:with-param name="listedids" select="'|' + @id + '|'" />
    </xsl:apply-templates>
    </xsl:when>
    <xsl:otherwise>
    <!--     check1: startdate, enddate, starttime and endtime within current playlisttime and endtime, check2: nextid not already displayed (not within listedids)-->
    <xsl:apply-templates select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($playlistDate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan(./data[@alias='EndDate'],$enddate) or (umbraco.library:ShortTime($playlistDate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)) or contains($listedids, '|' + @id + '|'))][1]" mode="playlistItems">
    <xsl:with-param name="playlistDate" select="umbraco.library:DateAdd($playlistDate,ms,data[@alias='Duration'])" />
    <xsl:with-param name="listedids" select="$listedids + '|' + @id + '|'" />
    </xsl:apply-templates>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:if>
    </xsl:template>

    <xsl:template name="imageItem" match="node[@nodeType='1050']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="img" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    <url type="img" address="{./data[@alias='src']}" />
    </timeslotentry>
    </xsl:template>

    <xsl:template name="videoItem" match="node[@nodeType='1052']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="vid" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    <url type="vid" address="{./data[@alias='src']}" />
    </timeslotentry>
    </xsl:template>

    <xsl:template name="flashItem" match="node[@nodeType='1054']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="flv" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="seaMapItem" match="node[@nodeType='1057']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="sea" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="CheckinScreenItem" match="node[@nodeType='1059']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="chkin" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="WeatherMapItem" match="node[@nodeType='1055']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="wea" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="WeatherPrognoseItem" match="node[@nodeType='1056']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="wep" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="CrewItem" match="node[@nodeType='1058']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="crw" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    </xsl:stylesheet>

     

    My querystring I'm using is: ?solution=1062&playlist=1063&startdate=2009-07-22T00:00&enddate=2009-07-22T23:59

    If i change the querystring to ?solution=1062&playlist=1063?&startdate=2009-07-22T00:00&enddate=2009-07-22T23:59

    the output ht-/xml is

     2009-07-22T00:002009-07-22T23:5910621063?<slots><slot id="slot1" starttime="2009-07-22T00:00" endtime="2009-07-22T23:59" /></slots>

    Also if I comment out (in good old html <!-- --> style) the first call to the recursive template namely this:

    <slots>

    <slot id="slot1" starttime="{umbraco.library:RequestQueryString('startdate')}" endtime="{umbraco.library:RequestQueryString('enddate')}">

    <!--
    <xsl:apply-templates select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($startdate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan(./data[@alias='EndDate'],$enddate) or (umbraco.library:ShortTime($startdate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)))][1]" mode="playlistItems">
    <xsl:with-param name="playlistDate" select="$startdate" />
    <xsl:with-param name="listedids" select="0" />

    </xsl:apply-templates>
    -->

    </slot>
    </slots>

    My output looks like this:

     2009-07-22T00:002009-07-22T23:59106210632009-07-16T20:56:20<slots><slot id="slot1" starttime="2009-07-22T00:00" endtime="2009-07-22T23:59" /></slots>

     

    Your help is much appreciated, feel free to school me in other coding matters than my essential problem here, I can only get better from where I am now.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 24, 2009 @ 10:44
    Douglas Robar
    0

    I don't understand what you're asking.

    Is the problem that you don't get a </slot> in the output and that's why you've marked the output with a small red box around the /> closing of the <slot tag? If so, simply change your

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

    to

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

     

    Or is the problem that you get a parsing error, as you mentioned at the top of your post? If so, tell us more about the parsing error.

    Or is it that the recursive template doesn't seem to be doing anything because you get the same output no matter what?

     

    My apologies if I've missed something obvious.

    cheers,
    doug.

  • Jakob 38 posts 54 karma points
    Jul 24, 2009 @ 11:25
    Jakob
    0

    My problem is that I'm getting a parsing error. The other things where just things I did to debug in a way, and then maybe these symptoms meant something to someone else. The only thing that was obvious to me was that the parsing error was related to the recursive template call, as it is not there when I comment it out.

    The output is supposed to be xml, empty self-closing tags are not a problem, although the slot-tag should never be empty. I didn't notice the small red box it was put there automatically, not by my design.

    I think the chance of me not explaining myself in a good enough manner far exceeds the chance of you missing something obvious, I hope I did a good enough job in this second try, if not please give me a third opportunity :)

    Thanks!

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 24, 2009 @ 11:39
    Douglas Robar
    101

    Hi, Jakob,

    You're obviously skilled in xml and xslt so I suspect it is something subtle.

    There are two things to try which will help us find the problem. Both have the goal of providing the best error output, which hopefully will direct us to the source of the problem.

    1. Click the 'skip testing' checkbox on the xslt and save the xslt in umbraco. Now view the webpage on your site that uses the macro. Does it run? If so, the problem is in the sanity check umbraco uses when saving xslts. If not, run the webpage again but add umbDebugShowTrace=true as a querystring parameter. Scroll down and find the (probaby red) text that gives the xslt error message and paste that part into the forum.

    2. If the macro didn't run properly, un-check the 'skip testing' box and save the xslt again. Copy and paste the error message into the forum.

    cheers,
    doug.

  • Jakob 38 posts 54 karma points
    Jul 24, 2009 @ 11:51
    Jakob
    0

    Oh my, I guess I forgot this point. At testing level in the xslt editor I can succesfully save the page, the problem occurs when trying to view the macro, that's where it writes "Error parsing XSLT file: \xslt\Playlist.xslt"  that's why I don't even have an error message to guide me in the right direction.

    Thanks

  • Jakob 38 posts 54 karma points
    Jul 24, 2009 @ 11:54
    Jakob
    0

    The umbdebug gave me something tough - I will look into this. Thank you for reminding me how to debug a macro, I should've thought of that. Thank you so much:

    umbracoMacro InnerException String was not recognized as a valid DateTime.
    String was not recognized as a valid DateTime.
      at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
      at umbraco.library.DateGreaterThan(String firstDate, String secondDate)
    0,00967567106992649 0,004062

     

    I'll check that my variables and parameteres are not empty.

     

    Thanks a bunch, I'll get back to you on this

  • Jakob 38 posts 54 karma points
    Jul 24, 2009 @ 12:57
    Jakob
    0

    How I've wasted your time, it turns out that the xslt wasn't the problem I was. I should've been querying nodes 1063 and 1064 instead of 1062 and 1063, so probably no lessons learned other than don't be stupid :) My xslt, still doesn't do as I want however, but ofcourse that's easier for me to figure out than anyone else. When I've corrected the xslt and gotten the result I want I will put up the code just in case anyone else ever stumbles across this pust and find themselves missing the working xslt.

  • Jakob 38 posts 54 karma points
    Jul 24, 2009 @ 13:00
    Jakob
    0

    Thank you Dough as always for your patience, persistency and kind attitude, without your clues I could've sat here blind for atleast another day.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 24, 2009 @ 15:21
    Douglas Robar
    0

    You're very welcome, Jakob! I look forward to your final xslt script.

    For what it's worth, it looks like you may need to force the querystring into a real date/time type before using the date compare functions. When the values come in from the querystring they are simply strings.

    cheers,
    doug.

  • Jakob 38 posts 54 karma points
    Jul 24, 2009 @ 18:51
    Jakob
    0

    Perhaps I can have your take on this. My code now looks like this:

    <?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"/>


    <xsl:variable name="startdate" select="umbraco.library:RequestQueryString('startdate')" />
    <xsl:variable name="enddate" select="umbraco.library:RequestQueryString('enddate')" />
    <xsl:variable name="solution" select="umbraco.library:RequestQueryString('solution')" />
    <xsl:variable name="playlist" select="umbraco.library:RequestQueryString('playlist')" />

    <xsl:template match="/">
    <xsl:value-of select="count($currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($startdate,data[@alias='StartDate']) or umbraco.library:DateGreaterThan($enddate, data[@alias='EndDate']) or (umbraco.library:ShortTime($startdate) > data[@alias='StartTime']) or (data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)))])" />
    <slots>
    <slot id="slot1" starttime="{umbraco.library:RequestQueryString('startdate')}" endtime="{umbraco.library:RequestQueryString('enddate')}">
    <xsl:apply-templates select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($startdate,data[@alias='StartDate']) or umbraco.library:DateGreaterThan($enddate, data[@alias='EndDate']) or (umbraco.library:ShortTime($startdate) > data[@alias='StartTime']) or (data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)))][1]" mode="playlistItems">
    <xsl:with-param name="playlistDate" select="$startdate" />
    <xsl:with-param name="listedids" select="'|0|'" />
    </xsl:apply-templates>
    </slot>
    </slots>
    </xsl:template>

    <xsl:template name="playlistItem" match="node" mode="playlistItems">
    <xsl:param name="playlistDate" />
    <xsl:param name="listedids" />
    <xsl:variable name="currentID" select="@id" />
    <xsl:value-of select="$playlistDate" /><br />
    <xsl:value-of select="$listedids" />
    <xsl:apply-templates select=".">
    <!-- DURATION -->
    <xsl:with-param name="duration">
    <xsl:if test="data[@alias='Duration']=''">0</xsl:if>
    <xsl:value-of select="./data[@alias='Duration']" />
    </xsl:with-param>

    <!-- SOUND -->
    <xsl:with-param name="sound">
    <xsl:if test="./data[@alias='Sound']='0'">Off</xsl:if>
    <xsl:if test="./data[@alias='Sound']='1'">On</xsl:if>
    </xsl:with-param>

    <!-- JAVASCRIPT -->
    <xsl:with-param name="javascript">
    <xsl:if test="./data[@alias='javascript']=''">Not_Set</xsl:if>
    <xsl:value-of select="./data[@alias='javascript']" />
    </xsl:with-param>
    </xsl:apply-templates>

    <!-- recursive call starts here -->
    <xsl:if test="umbraco.library:DateGreaterThan($enddate, $playlistDate)">
    <xsl:choose>
    <xsl:when test="count($currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($startdate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan($enddate, ./data[@alias='EndDate']) or (umbraco.library:ShortTime($playlistDate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)) or contains($listedids, concat('|',@id,'|')) or $currentID = @id)]) = 0">
    <!-- check1: startdate, enddate, starttime and endtime within current playlisttime and endtime, check2: nextid not already displayed (not within listedids)-->
    <xsl:value-of select="count($currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($playlistDate,data[@alias='StartDate']) or umbraco.library:DateGreaterThan($enddate, data[@alias='EndDate']) or (umbraco.library:ShortTime($playlistDate) > data[@alias='StartTime']) or (data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)))])" />
    <xsl:apply-templates select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($playlistDate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan($enddate, ./data[@alias='EndDate']) or (umbraco.library:ShortTime($playlistDate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)))][1]" mode="playlistItems">
    <xsl:with-param name="playlistDate" select="umbraco.library:DateAdd($playlistDate,'s',(data[@alias='Duration']) div 1000)" />
    </xsl:apply-templates>

    </xsl:when>
    <xsl:otherwise>
    <!-- check1: startdate, enddate, starttime and endtime within current playlisttime and endtime, check2: nextid not already displayed (not within listedids)-->
    <xsl:apply-templates select="$currentPage/ancestor::root/descendant::node[@id=$solution]/node[@id=$playlist]/node[not(umbraco.library:DateGreaterThan($playlistDate,./data[@alias='StartDate']) or umbraco.library:DateGreaterThan($enddate, ./data[@alias='EndDate']) or (umbraco.library:ShortTime($playlistDate) > ./data[@alias='StartTime']) or (./data[@alias='EndTime'] > umbraco.library:ShortTime($enddate)) or contains($listedids,concat('|',@id,'|')) or $currentID = @id)][1]" mode="playlistItems">
    <xsl:with-param name="playlistDate" select="umbraco.library:DateAdd($playlistDate,'s',(data[@alias='Duration']) div 1000)" />
    <xsl:with-param name="listedids" select="concat($listedids,'|',@id,'|')" />
    </xsl:apply-templates>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:if>
    </xsl:template>

    <xsl:template name="imageItem" match="node[@nodeType='1050']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="img" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    <url type="img" address="{./data[@alias='src']}" />
    </timeslotentry>
    </xsl:template>

    <xsl:template name="videoItem" match="node[@nodeType='1052']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="vid" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    <url type="vid" address="{./data[@alias='src']}" />
    </timeslotentry>
    </xsl:template>

    <xsl:template name="flashItem" match="node[@nodeType='1054']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="flv" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="seaMapItem" match="node[@nodeType='1057']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="sea" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="CheckinScreenItem" match="node[@nodeType='1059']">
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="chkin" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="WeatherMapItem" match="node[@nodeType='1055']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="wea" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="WeatherPrognoseItem" match="node[@nodeType='1056']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="wep" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    <xsl:template name="CrewItem" match="node[@nodeType='1058']" >
    <xsl:param name="duration" />
    <xsl:param name="javascript" />
    <xsl:param name="sound" />
    <timeslotentry type="crw" sound="{$sound}" duration="{$duration}" javascript="{$javascript}">
    </timeslotentry>
    </xsl:template>

    </xsl:stylesheet>

    I've bolded the issue part of the code.

    My querystring is this: ?solution=1063&playlist=1064&startdate=2009-07-10T23:30&enddate=2009-07-10T23:59&umbDebugShowTrace=true

    If I comment out that my ouput is:

    62009-07-10T23:30
    |0|2009-07-10T23:33:20
    |0||1066|2009-07-10T23:35:20
    |0||1066||1068|2009-07-10T23:39:40
    |0||1066||1068||1069|2009-07-10T23:40:40
    |0||1066||1068||1069||1071|2009-07-10T23:41:10
    |0||1066||1068||1069||1071||1072|6

    (the xml is there too, but just to show you in a textual visual way how and that it works I did it like this)

    If it is not commented out the page just doesn't load, I get a timeout on the script. One should think that 20 minutes of playlist would be fairly quick to generate, and the playlist up to 23:41:10 is also loaded without any delay. Do you have any ideas on what I could test when I get a timeout, and can't watch debugging information.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 25, 2009 @ 15:13
    Douglas Robar
    0

    It sure sounds like an endless loop to me. Can you simplify your xslt to isolate the issue (comment out the various match templates, for instance) so you can determine if the problem is in the templates or in the select of your apply-templates call? With a simplified example and a summary of the nodes and structure your xslt is working against perhaps we can help more. As it is... this is a bit complex to simpy look at the code and find the detail that isn't quite right.

    cheers,
    doug.

  • Jakob 38 posts 54 karma points
    Jul 26, 2009 @ 14:59
    Jakob
    0

    it's definately the select statement, and that's what's so weird, because it's basically the same as the first call.

  • Jakob 38 posts 54 karma points
    Jul 26, 2009 @ 18:06
    Jakob
    0

    the problem is with this test "or contains($listedids,concat('|',@id,'|'))" without it, it runs perfectly

  • Jakob 38 posts 54 karma points
    Jul 26, 2009 @ 20:41
    Jakob
    0

    or more specifically it's in the list of id's but I haven't yet figured out why this won't work.

  • Jakob 38 posts 54 karma points
    Jul 27, 2009 @ 10:42
    Jakob
    0

    I'm having doubts about it being an endless loop. I was able with another querystring to get:

    22009-07-23T11:20
    |0|2009-07-23T11:24:20
    |0||1069|2009-07-23T11:24:50
    |1072|2009-07-23T11:29:10
    |1069|2009-07-23T11:33:30
    |1069||1069|2009-07-23T11:34:00
    |1072|2009-07-23T11:38:20
    |1069|2009-07-23T11:42:40
    |1069||1069|

    it loads in a second or so, but if i prolong the period more than the 20-25 minutes, it will load for infinity. I'm pretty clueless in this.

  • Tommy Poulsen 514 posts 708 karma points
    Jul 27, 2009 @ 11:52
    Tommy Poulsen
    0

    Hi Jakob, without having examined your xslt thoroughly I think you face some serious recursive/nested template calls that gives you a bad performance for many nodes. E.g. doing general template matches or calculating count(...) every time in a loop is time consuming for many nodes. You could consider targeting and matching your templates more specifically or otherwise try to limit the time consuming functions.

    I may have time to look deeper into it later today

    >Tommy

     

  • Tommy Poulsen 514 posts 708 karma points
    Jul 27, 2009 @ 13:31
    Tommy Poulsen
    0

    e.g. this template match call could result in some really deep recursion as I see it:

    ...
    <xsl:template name="playlistItem" match="node" mode="playlistItems">
    <xsl:param name="playlistDate" />
    <xsl:param name="listedids" />
    <xsl:variable name="currentID" select="@id" />
    <xsl:value-of select="$playlistDate" /><br />
    <xsl:value-of select="$listedids" />
    <xsl:apply-templates select=".">
    <!-- DURATION -->
    ...      

    because you it looks as if you invoke your root template for every playlistItem node.

    >Tommy

  • Jakob 38 posts 54 karma points
    Jul 30, 2009 @ 11:20
    Jakob
    0

    I think I've reached the conclusion that the recursive call is a no go. I'm going to have to create a dll with c# code that recieves the nodelist and then spits back the playlist, and from there treat it in xslt.

  • Tommy Poulsen 514 posts 708 karma points
    Jul 30, 2009 @ 11:28
    Tommy Poulsen
    0

    Ok - I hope you'll find a nice solution.

    (I expect you tried to output some debug info during the xslt recursion to track how cray the recursion goes...)

    >Tommy

     

Please Sign in or register to post replies

Write your reply to:

Draft