开发者

XML and XSLT to generate CSS?

I want to provide user facility to change the CSS.

  1. First think clicked开发者_StackOverflow社区 is that storing CSS as XML will help me read CSS and understand.
  2. Second is that using XSLT i will be able to generate the CSS (am i right ? will that be useful)
  3. Lastly when user changed the CSS XML file can be updated and then it can be used.

Now this is at very rough level ..... i am using ASP.NET can some one please guide me if my understanding is correct or not and how should i approach for this pros/cons.

Will something like below will work ? is possible?

<link src="someserverfiletoprocessxmlusingxslt.aspx?user=id" type=text/css/> 


That is possible; your ASPX page would need to return CSS with a MIME type of text/css.

However, it would be better to use an ASHX (Generic Handler) rather than an ASPX (Web Form).


Using an ASP.NET generic HTTP handlers (ashx) would be better. This is just a class that gives you access to the output stream (better for non-html output).

From there you can process the XML, transform it using XSLT and write/dump it on the output stream.

Might be a good idea to implement some kind of caching to enhance performance...

More info on generic handlers: http://www.brainbell.com/tutorials/ASP/Generic_Handlers_(ASHX_Files).html


Setting the method attribute of the xsl:output element to text will strip the resulting output of all XML tags and return it unencoded.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜