Copied to clipboard

Flag this post as spam?

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


  • Jonas Eriksson 930 posts 1825 karma points
    Feb 15, 2010 @ 13:38
    Jonas Eriksson
    0

    Error parsing xslt, but no error message.

    Hi!

    I get an error parsing xslt on certain conditions, the xslt is saved fine and does get any error when i visualize it. When I run it with umbdebugshowtrace=1 there's no red error message lines either.

    Any suggestions on how to debug this one? I'm about to go disabling piece by pice of the xslt to find out what goes wrong here.

    Regards

    Jonas

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Feb 15, 2010 @ 13:48
    Douglas Robar
    0

    Sadly, debugging xslt can be a challenge. You've done all the obvious stuff so now you need to disable parts or add debugging output.

    If I were to guess, you may be looking for a property that doesn't exist in some situations and that's why it is failing. Use the string() function around your if statements and xpath selectors to avoid this problem. By casting to a string you won't have problems that could be handled by Exists, IsSet, IsNull, etc. in other languages... it'll just contain and empty string or the value of the property.

    You see this all the time in the sample xslt templates for checking the umbracoNaviHide property, for instance.

    Let us know what you find out.

    cheers,
    doug.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Feb 15, 2010 @ 13:51
    Kim Andersen
    0

    This one is always difficult to debug. I usually first check if I have any xslt-extensions in my xslt-file, and then try to outcomment those if there are any. If you open your file in Visual Studio, there will also be some help with your syntax, missing templates etc., but those kind of errors should be caught by Umbraco, if you saved your file in the backend.

    You could also try out the XSLT visualizer in the developer-section in Umbraco backend, maybe you can find something interesting in here.

    Otherwise, I think that you should disable the file piece by piece, like you also suggested yourself.

    Hope you'll find the error.

    /Kim A

  • Jonas Eriksson 930 posts 1825 karma points
    Feb 15, 2010 @ 14:05
    Jonas Eriksson
    0

    Yes, thank you both for your advice.

    I found the error. :-) It was in a inline .net-code, that was addressing a property I hade removed from the document type. Dooh. Need to remember to add more error handling /  in my own code.

    But - about the missing red lines. Would they be missing even if the error was in a xslt-extension?

    "Casting to a string", ok I'll definitely keep that advice for my further xslt-adventures.

    Regards

    Jonas

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 14, 2010 @ 13:22
    Jeroen Breuer
    1

    Debugging Xslt files can be very easy. There's a very simple trick I learned at the Benelux meetup. All you need to do is open the xslt file in Visual studio (works even on a new instance) and attach the debugger to your Umbraco website (w3wp.exe). Make a breakpoint and when you load the page containing the xslt file the breakpoint is hit and you can debug your xslt file the same way you can with a user control.

Please Sign in or register to post replies

Write your reply to:

Draft