Copied to clipboard

Flag this post as spam?

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


  • Sebastian Dammark 581 posts 1385 karma points
    Sep 17, 2015 @ 11:39
    Sebastian Dammark
    0

    Going from XSLT to Razor

    Lately I'm seen a lot of projects where Razor is required over XSLT, which is perfectly ok with me.

    To me, Razor is a qualified language as much as XSLT, or vice versa.

    The biggest issue to me is the environment. Doing XSLT, I can choose between the platform that suites me best, but I feel kinda forced towards Windows when I choose to do Razor.

    When doing XSLT you have the document structure in your head, or by using XMLDump (thanks to Chriztian, aka. @greystate).

    But as a non-windows user, I'm having a hard time figuring out the structure, or the lack of, when doing Razor.

    How do others go around this ?

  • Peter Duncanson 430 posts 1360 karma points c-trib
    Sep 18, 2015 @ 11:18
    Peter Duncanson
    0

    I always liked XSLT for its simplicity, it only really has 10 commands that you can use. Razor has almost unlimited methods, helpers, extension, etc. which mean that its pretty much a requirement to need Intellisense to use it. The only programs with good enough intellisense are Visual Studio and Web Matrix which does sort of force your hand onto Windows really. I've heard VS might be coming to the Mac but I'd not kept my finger on the pulse on that one.

    We had the same issues with James here at work and his Mac, I had to keep switching to Parallels just to get the Intellisense I needed to help him with a nasty loop or similar.

    Regarding keeping the data layout in your head (easy in XSLT its just a book mark in the tree right?) you just need to do a simple bit of mental modeling. The "Model" is the same as the data that would come in for your , then when you start moving around it you have to keep tabs on where you are.

    I 100% agree that this is not as readable as simply looking at the structure in the xpath (ie /root/faqs/faq[@id=2] you know exactly where you are, the equivilent in Razor can but a lot longer (unless you dump down to using getByXpath there too!)). Variables are you friends and a lot of nesting can really help too, each tab in can be a step further into the tree but thats a matter of opinion (and as you know I never have one of those).

    Pete

Please Sign in or register to post replies

Write your reply to:

Draft