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.
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.
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
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 :)
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.
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.
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.
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.
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.
<!-- 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>
(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.
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.
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
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.
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.
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
Also if I comment out (in good old html <!-- --> style) the first call to the recursive template namely this:
My output looks like this:
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.
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
to
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.
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!
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.
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
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:
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)
I'll check that my variables and parameteres are not empty.
Thanks a bunch, I'll get back to you on this
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.
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.
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.
Perhaps I can have your take on this. My code now looks like this:
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.
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.
it's definately the select statement, and that's what's so weird, because it's basically the same as the first call.
the problem is with this test "or contains($listedids,concat('|',@id,'|'))" without it, it runs perfectly
or more specifically it's in the list of id's but I haven't yet figured out why this won't work.
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.
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
e.g. this template match call could result in some really deep recursion as I see it:
because you it looks as if you invoke your root template for every playlistItem node.
>Tommy
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.
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
is working on a reply...