11. Transform XML to HTML by using XSL/XSLT

  Рет қаралды 72,961

Brandan Jones

Brandan Jones

Күн бұрын

Create an XSLT document that transforms XML into HTML, in a browser-friendly manner.
This video is part of a playlist on XML and XSD: • 1. XSD Overview: Why u...
Source code is freely available on GitHub at: github.com/dis...

Пікірлер: 42
@descobra5462
@descobra5462 8 ай бұрын
So its easier to plan out the html or text first then implement the xsl coding?
@discospiff
@discospiff 8 ай бұрын
That's my approach, yes. Design what the UI looks like, consider the data, then implement the data in the UI.
@muhammadkaabouchi8584
@muhammadkaabouchi8584 4 жыл бұрын
Cant we just use match instead of for each?
@amirulazmy1059
@amirulazmy1059 3 жыл бұрын
Hi do you have any tutorial on generating bar chart instead of table ? Thank you
@discospiff
@discospiff 3 жыл бұрын
If I needed to generate a bar chart, I'd use a library to do it. Something like bootstrap, just off the top of my head.
@franciscorojao6552
@franciscorojao6552 4 жыл бұрын
Hi, so basically i copied your XSD, XSL and XML and when i try to see the output on the browser, it just shows de content of the xml, nothing of the tables , name or the content in h1 tag. Any idea how to resolve this? Thank you for your time.
@discospiff
@discospiff 4 жыл бұрын
What browser are you using? If you're opening the file locally, each browser handles it a different way, due to security policies. If you run it through a web server and then own it in a browser with a url, they are more consistent, and they should parse it properly.
@asmaghanty7597
@asmaghanty7597 4 жыл бұрын
@@discospiff hi I encountered the same problem. I use Google Chrome
@annemarieg.3084
@annemarieg.3084 4 жыл бұрын
I don't understand the use of the .xsd file here, could this not be done between the .XML and .xsl files alone?
@discospiff
@discospiff 4 жыл бұрын
Yes, you only need XML and XSL to transform XML to another format (like HTML). While optional, the XSD does provide a very valuable purpose: it ensures that the XML is in good form, so that it can be transformed.
@annemarieg.3084
@annemarieg.3084 4 жыл бұрын
Thank you. I've followed this tutorial trying to create my own Students Grades xsl file but the .xsl is still being rendered as a XML unformatted, I have put all the necessary tags as shown in the video and even created the additional xsd file but the end result still doesn't appear html formatted
@discospiff
@discospiff 4 жыл бұрын
@@annemarieg.3084 It's very browser dependent. In my experience: 1) IE/Edge: will perform the transformation on a local file (on your hard drive), or one that is hosted remotely. 2) Chrome: will not show anything if you are loading a local file. Will parse properly if hosted remotely. Reason being, they consider it a security risk, if someone emails you an attachment with transformation, which spoofs a real website. 3) Firefox: will show the raw data, unformatted, as I recall, if from local. Will parse properly if hosted. A trick if you have Visual Studio: you can place the files there, then run, debug, or preview the files in a browser. Visual Studio spins up an IIS instance, with a port, so the browser thinks the files are hosted remotely, and parses them correctly. I've placed the files I used on GitHub; you're welcome to try them for yourself: github.com/discospiff/PlantPlaces18FS001/tree/master/PlantPlaces18FS001/PlantPlaces18FS001/XML Hope this helps. Brandan
@khouloudbentaoues641
@khouloudbentaoues641 3 жыл бұрын
Thank you it's a great video. I wonder if it's possible to transform xml to to excel the same way ?
@discospiff
@discospiff 3 жыл бұрын
Hmmm. Possibly to CSV... if the data fits csv format.
@liamso8384
@liamso8384 4 жыл бұрын
Thanks for the help! You mentioned that you can use CSS to style the page, do you have a video where you go through this?
@discospiff
@discospiff 4 жыл бұрын
I don't have a video example of CSS and XSL, but I have done it before. Basically... just look at the output you'd see in a browser. It looks like HTML. Formulate the CSS to match up to that rendered HTML. So, you can still use the same things you would in an HTML page: id, class, or tag selectors. You can import the CSS the same way, because that's imported by the browser, after the XSL transformation has already occurred on the XML... so by that point, it just looks like normal HTML, if transformed properly. Hope this helps!
@gustavopuggina2732
@gustavopuggina2732 4 жыл бұрын
Thanks for the video. I want to know, if I use div instead of table could I have the same effect, or how to alternate the colors of the lines? If you would help me.
@discospiff
@discospiff 4 жыл бұрын
You can use any HTML tag, so div is fine. To alternate colors, a few options: 1) Consider a library, like Bootstrap, that has this built in. You can include bootstrap here as you would an HTML page. getbootstrap.com/ 2) Use CSS's even/odd attribute: www.w3.org/Style/Examples/007/evenodd.en.html Hope that helps!
@maes4224
@maes4224 3 жыл бұрын
Thank you so much for this tutorial it helped me a lot!!! Regards, from Peru
@discospiff
@discospiff 3 жыл бұрын
Glad it helped! I've been to Peru myself. A beautiful place. Some of my co-workers live in Peru, too!
@azharkazi7299
@azharkazi7299 4 жыл бұрын
Hi Brandan: Great video Helped me.. However when i followed your code to convert my XML data into HTML... But I am unable to get the text of each tag in the table... What I am getting is the table with headers content...
@discospiff
@discospiff 4 жыл бұрын
Try different browsers. I have noticed that they all treat XSL transformations differently. See if you get different results. If you get the same results, look very closely at angle brackets and quotes. Perhaps one is missing.
@sdominguez8
@sdominguez8 4 жыл бұрын
Brandan thank you so much for this series! Helped me a lot! 🙌👏
@discospiff
@discospiff 4 жыл бұрын
Glad to hear it! What was helpful?
@ianlow78
@ianlow78 3 жыл бұрын
There is no Table element in any of the GitHub files. I think this is why people are confused.
@ianlow78
@ianlow78 3 жыл бұрын
github.com/discospiff/PlantPlaces18FS001/blob/master/PlantPlaces18FS001/PlantPlaces18FS001/plants.xsl This is the file you need.
@yaz9329
@yaz9329 7 ай бұрын
Brandan you are the best
@discospiff
@discospiff 6 ай бұрын
Thanks so much! Though I don't know that I'm thaaaaat good. :)
@dukelukeum
@dukelukeum 6 жыл бұрын
25.2744° S, 133.7751° E is Australia. Love the video! Helped me a lot.
@discospiff
@discospiff 6 жыл бұрын
I don't recall if I said that in the video, but I did GPS several plants in Sydney, Adelaide, and Melbourne. Mostly Acacia (waddle) and Ficus (fig)! Oh, and New Zealand Christmas Tree. It takes a very long time to get to Aus from Cincinnati, Ohio, USA; but my wife and I love it. It was the first place we ever went to outside of the USA, and it's where we spent our honeymoon! We've been back two more times since, including New Years Eve 2016-2017!
@CarlosTorres-oo2ss
@CarlosTorres-oo2ss 4 жыл бұрын
I love you, sir.
@M310GL
@M310GL 4 жыл бұрын
It helps me a lot!! Thank you!!
@discospiff
@discospiff 4 жыл бұрын
Glad it helped! XSLT is a nice way to make XML human readable. I think the biggest trick is knowing that you have to link the XSL document from the XML document.
@MaelowPi
@MaelowPi 4 жыл бұрын
This greatly helped. Thank you!!!
@discospiff
@discospiff 4 жыл бұрын
Glad to hear it helped! XSLT is a nice way to make XML look like HTML.
@エレダー
@エレダー 6 жыл бұрын
unsafe for chrome : R.I.P, only for chrome
@wafaeuchi3311
@wafaeuchi3311 6 жыл бұрын
Code please
@jeevannileshwar
@jeevannileshwar 6 жыл бұрын
What code?
@maxmalinouski7398
@maxmalinouski7398 4 жыл бұрын
Спасибо, очень помогло)
@discospiff
@discospiff 4 жыл бұрын
Пожалуйста. Спасибо за просмотр.
@AlienEyes
@AlienEyes 4 жыл бұрын
nice video, but a quick tip. Sometimes you drag along whats not the subject of the video, for-instance, you explain how a table is build, jada-jada. I know that already, and it is not the essence of this video (correct me if I am wrong, this is the only video I have seen from you).
12. Uploading and Saving a file in C# .net; Validating XML
18:58
Brandan Jones
Рет қаралды 7 М.
XSLT XPath Tutorial
1:08:20
arbitrarytechnology
Рет қаралды 46 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Advanced Elementor Container Tutorial: A Ribbon Full Width Layout
24:42
The HTML Tags They NEVER Taught You
7:39
Giodev
Рет қаралды 154 М.
XSL techniques for XML-to-XML transformations
59:39
Scriptorium Publishing
Рет қаралды 41 М.
1. XSD Overview: Why use XSD? What is a simple type?
12:12
Brandan Jones
Рет қаралды 49 М.
Another 5 Must Know CSS Tricks That Almost Nobody Knows
15:13
Web Dev Simplified
Рет қаралды 77 М.
HTML Tutorial for Beginners: HTML Crash Course
1:09:34
Programming with Mosh
Рет қаралды 9 МЛН
The only tags you need when first learning HTML
17:07
Kevin Powell
Рет қаралды 56 М.
Simple Explanation of Maven and pom.xml
17:37
Brandan Jones
Рет қаралды 232 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН