开发者

Is there any reasons to prefer SparkViewEngine over XSLT (or vice versa) for a standalone email generation?

I have a service that receives an object containing all the data needed to build a newsletter. I need to be able to generate the email using different templates. I don't want to involve the whole ASP.NET stack for that, so I want a separate templating engine.

Reading a lot of opinions, I have found that XSLT was not getting very much love when it comes to templating engines. Why?

SparkViewEngine is a "new cool toy", but it seems mature enough considering the number of projects that have been built with it. What do you think?

Did you used those 2 engines? in which situatio开发者_如何学Cn, and what strength/pain did you enjoy/endure


XSLT is much more verbose, especially when it comes to tricks like conditional attributes. I used it a lot (even to generate C#/C++ source code) but I don't remember that time to be a joy. Spark is.


I used a Spark template to generate an email on my last project, it was a fairly straight forward experience.

As you mentioned you have an object containing all the data needed to build a newsletter. To use XSLT wouldn't you need to serialize to to XML first? Using Spark skips the serialization step and gets you directly to the output you want, and as queen3 mentioned, creating conditional attributes is quite easy.

In case you need it, there's a post on how to use Spark as a general purpose templating engine here.

Also if you have to work with any graphics designers it may be easier to take an HTML mockup and turn it into a spark template than it would be taking an HTML mockup and turning into an XSLT.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜