A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
 Current location:home‹php forum‹php talk in 2008 year‹When to use xml with xsl instead of HTML? - page 1
User InfoPosts
 When to use xml with xsl instead of HTML? #1 I like .NET webcontrols and you manipulate things, that's common consensus, but XML and XSL is so great, because you have UI logic that is platform & language-independent, so one day I change the app to php, java or whatever and i can reuse all the presentation logic. Moreover, XSL has the possibility to call .NET (or whatever) methods before rendering.When do you use XML/XSL normally? why no to use it more frequently?posted date: 2008-12-23 02:11:00

 Re: When to use xml with xsl instead of HTML? #2 I had made out the solution of this problem. click to view my topic...hope that hepls.posted date: 2008-12-23 02:11:01

 Re: When to use xml with xsl instead of HTML? #3 Not so much in the ASP.NET stuff, but before that (with VB6) I used to use it almost exclusively (at the server) to transform xml to html. I've always found it incredibly versatile. I also use it in my "protocol buffers" project as the code-generator engine: the main framework produces xml, and then I use an xsl transform to spit out the C#. I've heard people say they don't find xsl intuitive, but I really like it, and it is my default ttool when processing xml.Right now, I'm looking lots at ASP.NET MVC, which doesn't necessarily lend itself to xsl much - although in some ways, there isn't much between <%=foo.Name%> and .posted date: 2008-12-23 02:44:00

 Re: When to use xml with xsl instead of HTML? #4 Instead of HTML?I use it constantly in place of asp.net controls since it affords the separation of concerns for the V and the C in 2.0 that you don't get in .NET 2.0 out of the box. Obviously there's a million other uses unrelated to asp.net controls.Edit: a sketch of an implementationpublic class xsltmanager{ /* constructor (singleton) which defines a file watcher for *.xsl in the path of your choice */ //just a mutex for thread safety private object Mutex = new object(); //caching XslCompiledTransforms private Dictionary cTransforms = new Dictionary(); public XslCompiledTransform fetch(string identifier) { if (!this.cTransforms.ContainsKey(identifier)) { lock (this.Mutex) { if (!this.cTransforms.ContainsKey(identifier)) { XslCompiledTransform xslDoc = new XslCompiledTransform(); xslDoc.Load(/* file path based on identifier */); this.cTransforms.Add(identifier, xslDoc); } } } return this.cTransforms[identifier]; } /* other util xslt methods - namespace wash, doc merge, whatever */}public class myPage : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { //get source data XPathDocument xPathDoc = myGetXMLMethod(); //transform params XsltArgumentList oArgs = new XsltArgumentList(); /* add params as required */ //fetching and executing the transform directly to the Response here xsltmanager.instance.get(@"foo\bar\baz").Transform(xPathDoc, oArgs, Response.OutputStream); }}posted date: 2008-12-23 02:55:00

 Re: When to use xml with xsl instead of HTML? #5 how do you integrate it with .NET?posted date: 2008-12-23 03:31:00

 Re: When to use xml with xsl instead of HTML? #6 Essentially just transforming against Response.OutputStream in the codebehind.posted date: 2008-12-23 04:09:00

 Re: When to use xml with xsl instead of HTML? #7 There is a huge overhead on using XML/XSL and there are many disadvantages.You need a complete XML dataset to ensure that the XSL is only used as a logic engine.Second, the XSL logic control is poor and is inconsistent between versions.Third, the combination is quite an heavy process, unsuitable for large sites.If you are concerned about logic separation, use some templating language (that is not XSL).posted date: 2008-12-23 04:57:00

 Re: When to use xml with xsl instead of HTML? #8 I reject all of this: XSL is not a logic engine, it's a presentation engine. XSLT's "logic" for templating is extraordinarily powerful and pretty damned consistent within any given framework. Given the language is designed for templating it's also very fast. Cache to avoid file IO and use XPathDocposted date: 2008-12-23 05:04:00

 Re: When to use xml with xsl instead of HTML? #9 if you don't mind, could you provide some code of integration of a .aspx (or whatever) with xml/xsl?thanks in advanceposted date: 2008-12-23 05:09:00

 Re: When to use xml with xsl instead of HTML? #10 retaliatory downvoting? well done youposted date: 2008-12-23 05:10:00

 Re: When to use xml with xsl instead of HTML? #11 This answer's totally contrary to my experience in all particulars. I don't even know what "the XSL logic control is poor" can possibly mean.posted date: 2008-12-26 23:42:00

 Re: When to use xml with xsl instead of HTML? #12 To a first approximation, I use XSLT whenever I need to present information as HTML. Just about every time I''ve deviated from this in the last seven years I've regretted it. My brief experience with HTML generation in Python is the only thing I've encountered yet that may possibly be able to replace it.posted date: 2008-12-26 23:46:00

select page: « 1 »