11. Transform XML to HTML by using XSL/XSLT

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ต.ค. 2024

ความคิดเห็น • 42

  • @maes4224
    @maes4224 3 ปีที่แล้ว +1

    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!

  • @sdominguez8
    @sdominguez8 4 ปีที่แล้ว +2

    Brandan thank you so much for this series! Helped me a lot! 🙌👏

    • @discospiff
      @discospiff  4 ปีที่แล้ว

      Glad to hear it! What was helpful?

  • @dukelukeum
    @dukelukeum 6 ปีที่แล้ว +2

    25.2744° S, 133.7751° E is Australia. Love the video! Helped me a lot.

    • @discospiff
      @discospiff  6 ปีที่แล้ว +1

      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!

  • @yaz9329
    @yaz9329 4 หลายเดือนก่อน

    Brandan you are the best

    • @discospiff
      @discospiff  4 หลายเดือนก่อน

      Thanks so much!
      Though I don't know that I'm thaaaaat good. :)

  • @MaelowPi
    @MaelowPi 4 ปีที่แล้ว

    This greatly helped. Thank you!!!

    • @discospiff
      @discospiff  4 ปีที่แล้ว +1

      Glad to hear it helped! XSLT is a nice way to make XML look like HTML.

  • @descobra5462
    @descobra5462 6 หลายเดือนก่อน

    So its easier to plan out the html or text first then implement the xsl coding?

    • @discospiff
      @discospiff  5 หลายเดือนก่อน

      That's my approach, yes. Design what the UI looks like, consider the data, then implement the data in the UI.

  • @M310GL
    @M310GL 4 ปีที่แล้ว

    It helps me a lot!! Thank you!!

    • @discospiff
      @discospiff  4 ปีที่แล้ว +1

      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.

  • @CarlosTorres-oo2ss
    @CarlosTorres-oo2ss 3 ปีที่แล้ว

    I love you, sir.

  • @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 ปีที่แล้ว +2

      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!

  • @maxmalinouski7398
    @maxmalinouski7398 4 ปีที่แล้ว

    Спасибо, очень помогло)

    • @discospiff
      @discospiff  4 ปีที่แล้ว +1

      Пожалуйста. Спасибо за просмотр.

  • @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.

  • @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 ปีที่แล้ว +1

      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!

  • @muhammadkaabouchi8584
    @muhammadkaabouchi8584 4 ปีที่แล้ว

    Cant we just use match instead of for each?

  • @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.

  • @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.

  • @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.

  • @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 3 ปีที่แล้ว

      @@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 ปีที่แล้ว +1

      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 ปีที่แล้ว +2

      @@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

  • @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).

  • @エレダー
    @エレダー 6 ปีที่แล้ว

    unsafe for chrome : R.I.P, only for chrome

  • @wafaeuchi3311
    @wafaeuchi3311 6 ปีที่แล้ว +1

    Code please