Help in XML content transform to html - html

In my current project, I need to add information from an xml file to my html template using XSL. Does anyone know how to do it. I tried creating an xsl file and run, it just creating a temporary file and when I closed, it got deleted. I have a separate html template, I just need to add the xml file contents to it.
Thanks

Your question is rather unclear to me.
From your question I infer that you mean XSLT.
Where exactly should the transformation happen? Client-side (e.g. web browser) or server-side? Both approaches have different advantages.
What kind of HTML template is it?

Related

I have created an html generating js function based on JSON. Is this more effective than templating engines or doing it manually by code?

Could you please check if this function is more effective from a coding point of view than templating engines or manually creating the html elements through code?
https://github.com/krishnakumar-m/simple-html-templating-json
I have checked github for use of JSON to generate HTML. But was not able to find any. I found this a bit more handy while dynamically generating html elements, because I was able to visualize the HTML as JSON.
Why are we not using JSON for structuring HTML this way? Is there a catch here? Or are there libraries which does the same thing?

Store data from HTML to XML file

Hello im trying to learn about XML , XML is media for store data but HTML media for display data, how can I store data from HTML to XML ?
Because i'd like to build some quiz maker that build up into HTML and store in XML, any tutorial/references for this?
thanks
XML is just a fancy way to store data for your application. It's a standard which means that you can easily export data from one application into another. If you are interested in this, take a look at this page: http://www.w3schools.com/xml/xml_parser.asp
You will need to use html and javascript to build a quiz. If you want you can make your quiz load questions and answers from XML.
HTML is a specialized language written in XML to describe how a webpage renders. HTML is valid XML however they very different things.
The question is very open ended, so it's hard to answer. One way is to post data from your html based website to your server and store it as xml.
However, it all depends on how you intend to use it.
I assume you mean "How can I load data stored in XML to html website". The simplest answer I can think of right now would be using jquery/javascript.
http://think2loud.com/224-reading-xml-with-jquery/
https://stackoverflow.com/questions/10811511/jquery-how-to-get-xml-data
https://stackoverflow.com/questions/16113188/convert-xml-to-html-using-jquery-javascript

Beautifying HTML with JSP mixed in

Does anyone know of an HTML beautifier that can deal with (or at least ignore) JSP? I've searched high and low... I'm not looking for an HTML validator, just something that can format the file decently (i.e. indentation).
Most good IDE's will let you say which code template to use as default within another file extension.
So i use PHPstorm in which i can say, for example that a *.jsp will use html first and then jsp. This way the page will display and reformat my code with the correct spacings and what not.
Worth looking into which IDE you are using, assuming you're using one :)

How to embed link HTML into CSS file for menus?

I know something like this is possible, I'm pretty sure I'm just wording it wrong as I've been searching online for hours to no avail.
The same way an HTML page refers to the CSS file for a menu design, how can the HTML page also refer to a file (or the same CSS file if possible) to get the links information? So when I change the link information in that one file, it changes links on all HTML pages referring to it. Is this possible?
There is no simple way to do this. In general this happens server-side and is drawn from a database.
You CAN draw this data from a JavaScript file, using HTML templating without having to depend on a server. This may help.
http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-an-introduction-to-jquery-templating/

How can I make a Table of Contents frame in XSL?

I have an XML file that I am creating an XSL stylesheet for.
What I would like is to have two frames and do two passes on the data, the first would create a Table of Contents in the left frame, and the second would have the body of data in the right.
I can do the two passes, the problem is putting them in separate frames. The frame HTML element takes in a source; I can't put my source directly in there.
I can think of a few ways to get around this, none of which I'm thrilled with, so I wanted to see if anyone had found a way to do this.
As said before, you need 3 files for this.
In XSLT 2.0 you can generate multiple output files from one xsl stylesheet using the xsl:result-document instruction.
In XSLT 1.0 you don't have that function, but depending on the processor it might be possible. For example for Xalan see http://xml.apache.org/xalan-j/extensions_xsltc.html#redirect_ext
If you want to use frames you need three separate files.
The frame file. This is just a strict HTML file
A file for your table of contents
A file for your content
The first one is as specified just an HTML file. The second two are XSL files that will eventually turn into HTML. A good tutorial on frames is here at W3Schools.
EDIT: The more I think about this, the more I dislike the solution. It requires the XSL parser to be run twice for each time the initial page is served
Have you thought about using CSS or tables to do your layout? There are some really good open source CSS templates flying about here on the interwebs.
This was relatively stable data that would be generated by a script, so what I ended up doing was creating separate stylesheets for the TOC and the main window, then using those to generate html files for each of them after I generate the html.
Then my main page was just a static html page that referenced these generated html files.
There's probably a better way to do it, but this is an internal reference, so this is enough to get me going.