XSLT Beginner Tutorial with Demo
HTML-код
- Опубликовано: 20 сен 2024
- website - automationstep...
What is XSLT
How XSLT works
XSLT Demo
References - XML and XSL files used in video - bit.ly/37rCTqK
XSL - eXtensible Stylesheet Language
XSLT stands for XSL Transformations
XSL is a styling language for XML
XSLT is used to transform XML documents into other formats like HTML
Join Automation Step By Step channel: www.youtube.co...
My Udemy Courses - automationstep...
Every LIKE & SUBSCRIPTION gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can.
_______ ONLINE COURSES TO LEARN _______
automationstep...
GitHub - github.com/Rag...
Udemy - www.udemy.com/...
Training by Raghav at your venue - raghav.qna@gmail.com
Training schedule - automationstep...
----------- UI TESTING -----------
Selenium Beginners - bit.ly/2MGRS8K
Selenium Java Framework from Scratch - bit.ly/2N9xvR6
Selenium Python - bit.ly/2oyMp5x
Selenium Tips - bit.ly/2owxc50
Selenium Builder - bit.ly/2MKNtlq
Katalon Studio - bit.ly/2wARFdi
Robot Framework with RIDE- bit.ly/2Px6Ue9
Robot Framework with Eclipse - bit.ly/2N8DZxb
Protractor - bit.ly/2KtqVkU
TestProject - bit.ly/2DRNJYE
----------- API TESTING -----------
Web Services (API) - bit.ly/2MGafL7
SoapUI - bit.ly/2MGahmd
Postman - bit.ly/2wz8LrW
General - bit.ly/2PYdwmV
Katalon Studio API Testing - bit.ly/2BwuCTN
----------- MOBILE TESTING -----------
Appium - bit.ly/2ZHFSGX
Mobile Playlist - bit.ly/2PxpeUv
----------- CI | CD | DEVOPS -----------
Jenkins Beginner - bit.ly/2MIn8EC
Jenkins Tips & Trick - bit.ly/2LRt6xC
Docker - bit.ly/2MInnzx
Kubernetes - bit.ly/2MJIlMK
------------VIRTUALISATION------------
Virtualization on windows - bit.ly/2SItIL9
----------- VERSION CONTROL SYSTEM -----------
Git & GitHub - bit.ly/2Q1pagY
GitLab - bit.ly/2kQPGyQ
----------- PERFORMANCE TESTING -----------
JMeter Beginner - bit.ly/2oBbtIU
JMeter Intermediate - bit.ly/2oziNVB
JMeter Advanced - bit.ly/2Q22Y6a
JMeter Tips & Tricks - bit.ly/2NOfWD2
Performance Testing - bit.ly/2wEXbLS
----------- PROGRAMMING -----------
Java Beginners - bit.ly/2PVUcXs
Java Tips & Tricks - bit.ly/2CdcDnJ
GROOVY - bit.ly/2FvWV5C
JAVASCRIPT - bit.ly/2KJDZ8o
PYTHON - bit.ly/2Z4iRye
----------- IDE -----------
Visual Studio Code - bit.ly/2V15yvt
----------- BUILD TOOLS -----------
Maven - bit.ly/2NJdDRS
Gradle - bit.ly/30l3h1B
----------- OTHERS -----------
Redis- bit.ly/2N9jyCG
Misc - bit.ly/2Q2q5xQ
Tools & Tips - bit.ly/2oBfwoR
QnA Friday- bit.ly/2NgwGpw
Sunday Special - bit.ly/2wB23BO
Ask Raghav - bit.ly/2CoJGWf
Interviews - bit.ly/2NIPPxk
All Playlists - bit.ly/2LSiezA
---------- Connect with Raghav -----------
Website - automationstep...
LifeCharger -
Udemy Courses - www.udemy.com/...
Facebook - / automationstepbystep
Twitter - / learnwithraghav
RUclips - / automationstepbystep
Never Stop Learning
Raghav
You're doing great job. Few years before this was my career goal, exactly what you're doing, pickup small topics and teach in few minutes but gave up due to other commitments. Now happy to see someone is doing the same and in great way. Appreciate you.
Hi Anushya, thanks for your kind words, I always believe that you can start any time of your life.
This was a really good high-level overview of XSLT.
Thanks for watching Cynthia
Great vid. XSLT is a special purpose programming language to transform XML source data input. You can output TXT, HTML, or more XML. It can be used for rendering HTML (styling source XML). XSLT also contains data types, variables, and lots of functions like a regular programming language, which enables you to do math calculations, manipulate strings, etc. In addition to YT videos I also got 2 books cheap online and they were HUGELY helpful. XSLT has 4 data types: node-set, number, string, boolean. Every input/source XML document is seen as a list of nodes. The 7 node types are: root, element, namespace, attribute, text, comment, processing instruction.
Thanks a lot for adding this
Thank you so much, you're a lot better at explaining this stuff than my teacher! Really appreciate it.
You are so welcome!
Thank you for this tutorial! I hope I get the job I was applying that requires this.
I hope so too! all the best
@@RaghavPal I got the job! Thank you!
You made it very easy to understand XML and XSL and how to link an XML file to an XSL and present it in the browser. Thank you
My Friend Where were you ?? Thank you Sir. You are a GREAT Teacher, Cleared my all Questions.
This is a very good introduction to XSLT .
Thanks a lot
God.....!! This is really transparent 👏You really did it in 15min what my prof failed to do it in a semester.
Thanks a Million ✨
So happy & humbled to see your message Kedareswari
Sad that we still need to know that in school.
Thanks for summing it up!
Most welcome
Thank you very much! This video was a very good starting point. Hope you have a wonderful day! :D
Glad you enjoyed it
Really trying to learn quickly for a job interview, thank u...you’re a good teacher
Best of luck
The video is very descriptive and I can see it helped loads of people. I have downloaded the codes from the Google Drive provided, and when I drag the student.xsl file, this information is displayed: "This XML file does not appear to have any style information associated with it. The document tree is shown below."
Hi Erwin,
The message you are seeing is likely due to the fact that the student.xml file you downloaded does not have any associated XSL style sheet file. An XSL file is used to transform the XML file into a human-readable format, such as HTML.
Here are some possible solutions to this issue:
Check the folder where you downloaded the files from Google Drive to see if the XSL file was included. If it wasn't, you may need to search for it separately or ask the person who provided the files for it.
If you do have the XSL file, make sure it is in the same directory as the XML file. The XML file needs to reference the XSL file in order to apply the formatting.
Open the XML file in a web browser that supports XSL transformations, such as Internet Explorer or Firefox. If the XSL file is referenced correctly, the browser should display the formatted output.
If you still can't see the formatted output, check that your browser's security settings are not blocking the XSL transformation. You may need to enable active content or allow the page to run scripts in order to see the formatted output.
If none of these solutions work, you may need to reach out to the person who provided the files or seek further assistance from an XML or XSL expert
@@RaghavPal thank you so much for replying. The second solution fixed it! I had to run it with Internet Explorer mode on Edge browser.
This is an amazing video, straight to the point, simple and clear. Thank you for sharing you knowledge. 😀
Most welcome Amanda
You are great I had exam today and you saved my life bro 🤜
Glad I could help Tushar.. humbled
Thank you sir. Thank you so much. It's very useful for my exam✨
Most welcome Sowmiya
Short Simple Crisp knowledge transfer!!!!!
Glad you think so Satish
Thank you. This was a great tutorial on how XSLT transformation works.
Most welcome Sonnet
thank u my bruddah. Was literally struggling to get a friggin' output when u came along
Glad I could help
Thank you so much! it was so easy to understand XML and XSL. You are way better than my instructor.
Glad it helped!
This is a perfect introductory example. Thank you very much
Most welcome
@@RaghavPal Sadly, however, trying it in Chrome or Brave produces a blank page and no error message. Has something changed?
ok, can try some online help on this
nice tutorial sir thanks for giving this information
Most welcome Yagnik
Very well explained with a simple example
Glad it was helpful
thank you for the video...appreciate your detailed explanation and examples cited...it was helpful for understanding from a beginners perspective..
You're very welcome Madhusmita
Excellent session. Very informative. Loved it and learned something that will help me in an upcoming project. Thank you.
So glad to know this Supriyo. Al the best
Thank you for making this so much easier to understand!
You're very welcome!
👌
Explained it very easily.
It is very helpful. Thank you.
Most welcome 😊
You are so lucid in exolaining things. Keep it up bro
Thanks
I truly appreciate your content and your hardwork!
Thanks a lot
Thank you for this video, it made it look so easy! And now I understand XSL :D
Glad it helped Nándor
nice. very easy to follow and great for a quick start.
Glad it helped
superb! from srilanka
Thanks Sanchali
ur the god
Humbled Dinesh
Thank you Raghav!
Most welcome
very useful vedio
thank you sir
Most welcome Jyotsna
Thank you very much for that explination it's very useful
You are welcome
This was really good tutorial.
I have a question
I have my XML in the below format
Bob
student num="2">
Jack
To reference student, can I still use the below in xsl?
Thank You
You can, I have not checked the syntax carefully, can also check this online
Thanks a lot..it was simple straight to the point..👏👏
Most welcome
THANK YOU SO MUCH SIR
Most welcome Jack
A great intro to XML and stylesheets! Thank you
Thanks for watching
Thank you, you're a great teacher.
You're very welcome!
Great explanation, but does not work on my current windows 11 - edge browser or google chrome ...
ok, will need to check the issue and errors
I had the same issue, modern browsers don't allow you to use local files in this way. If you don't want to host the file on a remote web server (like me), then you can use Live Server extension from VS Code or set up a local web server with XAMPP.
Helped me a lot with my course thank you
You're very welcome Manus
Very clear and best speed explanation
Most welcome
Hello, Thank you a lot for interesting video and explanation how XSLT works.
Glad it was helpful Michael
I am not technical background still understood very well explained
Thanks
Thank you.
You're welcome Padmini
please do a simple tutorial on xsd
I will plan Will
Thanks a lot for all the hard work. 👍
I learned a lot from your groovy tutorials. Please also do a series on xslt for XML transformation.
Hi Faisal, sure, will do
Excellent Sir... Thanks a lot
Most welcome
Awesome sir..
Thanks a lot..❣️
Most welcome 😊
The video presentation is good, easy to follow, but I'm still having trouble getting the table data to appear in the browser. I made sure to duplicate your content to see the result in the browser, however, all I get is what you see below. What am I doing wrong? What am I missing? Regardless of the browser I use, this is the result. Thanks for any advice I can get.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
Mick
Mouse
Mickey
Tony
To get the table data to appear in the browser, you need to use XSLT to transform the XML data into HTML. The XSLT file `student.xsl` should contain the following code:
```xslt
First Name
Last Name
Nick Name
```
Once you have created the XSLT file, you can transform the XML data into HTML using the following command:
```
xsltproc student.xsl student.xml
```
This will create a new file called `student.html` which will contain the table data. You can then open the `student.html` file in a web browser to see the table data.
Here is an example of what the table data would look like in the web browser:
```
First Name | Last Name | Nick Name
---------- | -------- | --------
Mick | Mouse | Mickey
```
thank you so much🤩
Most welcome Mahsa
very nice.. thanks
Most welcome
Hi. That was a very helpful. Now Internet explorer is no more available. I am unable to view XML in browser anymore using xsl stylesheet. can you please help?
Let's explore some solutions:
1. Browser Support for XSLT:
- Historically, most leading browsers supported client-side XSLT transformation. When you open an XML file with an associated XSL stylesheet, the browser would apply the transformation and display the output (usually HTML) instead of the original XML.
- However, recent changes mean that not all browsers handle this the same way anymore.
2. Recommended Approach:
- The standard way to associate an XSL stylesheet with an XML file is by adding a processing instruction within the XML file itself. Here's how:
```xml
```
Replace `"your-stylesheet.xsl"` with the actual path to your XSLT file.
- When you open the XML file in a browser, it should automatically apply the specified XSLT.
3. Browser Behavior:
- Firefox: Historically, Firefox supported this feature, but recent versions no longer apply XSLT transformations. It will display the content of the XML directly.
- Chrome and Edge: These browsers not only disallow XSLT but also won't display the XML content. They treat it as an unsupported format.
- IE: Although IE is no longer actively maintained, it used to handle XSLT transformations well. However, I recommend avoiding IE due to its security risks and lack of modern features.
4. Alternative Solutions:
- Server-Side Transformation: Consider performing the XSLT transformation on the server side (using PHP, Java, or other server technologies) and serving the transformed HTML to the browser.
- Third-Party Tools: Explore third-party tools or libraries that handle XML-to-HTML transformations. For example, Saxon-JS allows XSLT 3.0 to run in the browser.
- Local Development: During development, use local servers (e.g., Apache, Node.js) to serve your XML and XSL files. This ensures consistent behavior across browsers.
5. Debugging Tips:
- Check your browser's developer console for any error messages related to XSLT processing.
- Verify that your XML and XSL files are accessible via valid URLs.
- Ensure that your XSLT script is correctly written and doesn't contain errors.
Remember that XSLT usage has evolved, and browser support varies. If possible, consider migrating away from XSLT for client-side transformations.
Thank you 😊
You're welcome 😊
thank you so much
Most welcome Fatima
This is very useful video thank you
Most welcome
Very informative,thank you.
You are welcome
Write a simple XSLT that takes the above XMLs and writes out the same XML without any modifications. This means the output should match the input XML character by character. can any one hel
for now, will need to check online examples
Nice bro, thank you for helping automation here haha
Happy to help
thanks man.😃
Most welcome
thank you so much sir this was so helpful
Most welcome
Thanks !
Most welcome
i wrote the entire code line by line as you did, but it is not working. when i open the xml file with Microsoft egde, brave or chrome, it is blank. i checked the code in the validator, but it says "no error found". i am stuck and cant proceed further. what do i do?
Yadumohan
In case i can get more details on what and where exactly you are facing issue, I can help more specifically, in general here are few things you can check here:
1. Local File Access and Security:
- Browsers have security restrictions when loading local files (from the file system) and applying XSLT stylesheets.
- By default, Chrome (and other browsers) does not apply linked XSLT to local XML files due to security concerns.
- To overcome this, you can start Chrome with a specific flag to allow file access from local files. Here's how:
2. Solution for Chrome:
- Close all running Chrome instances.
- Open a new Chrome browser instance using the following command:
```
chrome.exe --allow-file-access-from-files
```
- This flag allows Chrome to apply the linked XSLT even for local files.
3. Firefox Alternative:
- If you need XSLT to work consistently with local files, consider using Firefox.
- Firefox does support XSLT over HTTP and from the local file system without additional configuration
4. Check for Missing Closing Tag:
- Ensure that your XSLT stylesheet has a closing `` tag. Sometimes missing tags can cause unexpected behavior.
- Verify that your XSLT file is complete and correctly formatted.
5. Browser Console:
- Open the browser console (usually by pressing F12) and check if there are any error messages related to XSLT processing.
- Chrome might provide additional information about why the XSLT was not applied.
6. Privacy Settings:
- In some cases, you might need to adjust privacy settings. For example, in Firefox, you can change the `privacy.file_unique_origin` property in `about:config` to `false` to apply XSLT styling to local files
Remember that XSLT processing for local files can be tricky due to security measures
thank you
You're welcome
Could you show a way that runs in google chrome? Suggestion: put a way to pay you regardless of plan, as a bonus. Thanks.
Hi, sure, I will check on that
Thanks for bring an excellent series course, could you please teach a lesson about how to use makefile or cmake?
I will try and plan for it
Very clear raghav ,pls make these kind of videos, actually i was searching in youtube gor a food video on xslt ,ur video is on top thanks for clear explanation
So nice of you, I will do more Manideep
Good job! Thank you!
Most welcome Yekaterina
This is pretty interesting. Thank you so much!
You're very welcome!
Thx a lot for your very awesome tutorials. Could you tell me which extension or default homepage did you take on chromebrowser specialy I means the clock and welcome page. Thx 😻😻😻
ok, thats a chrome extension - Momentum
@@RaghavPal Thx a lot
yes, very useful. thanks!
Glad it was helpful Rusti
Good stuff, thank you 👍 how can i preview for formatted xml in chrome without running a server?
Thanks,
To preview formatted XML in Chrome without running a server, you have a few options:
1. XMLTree Extension:
- Install the [XMLTree extension] from the Chrome Web Store.
- It provides a collapsible tree view for XML files, similar to what Internet Explorer offers.
- You can explore the XML structure and see open/close nodes.
2. Web Inspector (Developer Tools):
- Right-click on an XML node and select "Inspect Element."
- This opens the WebKit Web Inspector, which allows you to explore the XML structure, including highlighting and navigation.
3. Pretty XML Tree:
- There's another extension called [Pretty XML Tree](chrome.google.com/webstore/detail/pretty-xml-tree/ajfkkmnpfddpmdhjgdidplmcmfekfjeg) that uses XSLT to format XML.
- It aims to be faster and more efficient than the older XML Tree extension.
Give these options a try, and choose the one that best suits your needs. Happy XML browsing
--
@@RaghavPal cheers
Hi, Raghav.
Thanks for your efforts. It is been gew years i am following you and few other RUclipsr. I did not know anything about coding before that, but now I am Automation guy. You do not know me, but you are one of my heros. I have a plan for 2021. I am planning to one hours study everyday for full year. I will try my best to do it. If there is a compagin, i think it can change everyone life. How do you think about it. Can you please lead us to start one hour learning plan?
Thanks
Great to know this Enver, Sure let me know how can I support you
@@RaghavPal
Thank you for your reply. currently, I am doing selenium automation with Java. Since this is my first year, there are still some challenges at work. I have a dream to be a good automation Engineer in the next few years. as long as new things coming to market continuously, it is been kind of hard for me what to learn, if you can give me some suggestion of what to learn, it will be great,
thanks
Enver
Start with something you are already working with. Like Selenium for UI browser automation. You can learn to create frameworks in Java, Python, JS etc. Can also learn the tools that do UI Browser Automation testing, Then as per your interest or needs can start with other Automation testing topics like API, CI, CD etc. Will find all here - automationstepbystep.com/
so, how did that go? I'm curious.
I am using WINDOWS but you can also do it in any OS like mac or WINDOWS.....................
sure Daniel
Great work! Your explanation is really amazing. Can you also share how we can convert XML file to docx format using XSLT or by any other means? Thank you!
Hi Ambarish, thanks, I will work on this
thank you very much!
Most welcome
thnx mate
You're welcome!
Thank you so much!
Most welcome
you obly show about xsl . please show what is xslt .. what kind of transformation we can do from xsl
I will check and plan on this
thank you
You're welcome 😊
NICE
Thanks
Thanks great tutorial, but wouldnt it be usefull with a 3'th file who import both XML and XSL so we dont have to change the XML.
I will check on this
Great video, but is it wise for you to have all of that information about your system displayed in a public video?
Hi, i use temporary remote systems so should not be an issue, still pls tell me the time stamp so I can check again
Thank you so much sir
Most welcome
Hello sir, how you record your video and editing everything which software you used plz reply
Hi Aman, I use the mac in-built tools
Hi Sir, is XSLT is good to understand and work on it..i am not interested towards Java like coding...
Hi Bunny, what is the actual need in the project
Very good work
Thank you so much 😀
Hey Raghav, my XML/XSL only works when I run my XAMP server... any idea why? I want it to show by just opening a chrome tab (direct location clip, not via localhost)
Hi, it may be setup that way, take some help from your dev or networks team,
I didn't get anything in the XSLT at all, it kept on saying error when I checked the validator and kept on saying something about the prefix xsl not being bound but it showed valid on another validator though
will check on this
You didn’t explain the xsl tags. Ideally the for each should have been introduced after the first student was shown in the table. It’s misleading to say you don’t have to change anything when adding more students, when the foreach isn’t even required for one student.
I will reivew this Samiksha, thanks for letting me know
Hi, I have a question, what is the columns limit to print the output in excel like can we print more than 400 columns by using this xslt template.
Hi, I am not too sure and will need to check on it
So i used visual studio 2019 to run my xml find with a xslt file, when i open xml find on some browsers(MicrosoftEdge,Chrome), it shows nothing, then i open it on firefox and it only show text but the table i fommatted by xslt. Do you know why sir?
Sorry for my bad English
Hi Nguyễn
The behavior you described could be due to differences in how different browsers handle XML and XSLT rendering. Here are a few possible reasons why you might be experiencing this:
Browser Compatibility: Different browsers have varying levels of support for XML and XSLT rendering. Some browsers may handle the rendering of XML and XSLT more effectively than others. It's possible that the browsers you mentioned (Microsoft Edge and Chrome) have limitations or issues with rendering XML and XSLT in the way you expect.
XSLT Transformations: The XSLT file you're using might not be compatible with all browsers. Some browsers may have stricter interpretation of XSLT stylesheets or might not support certain XSLT features. This can result in inconsistent rendering or no rendering at all.
Security Restrictions: Browsers often have security measures in place that restrict the loading of XML and XSLT files from local file systems. This can prevent the XSLT transformation from being applied and result in the XML content not being displayed correctly.
To address these issues, you can try the following:
Ensure your XSLT file is well-formed and valid according to the XSLT specification.
Test your XML and XSLT files in multiple browsers to identify any browser-specific rendering issues. Consider using a browser that has better support for XML and XSLT, or use browser developer tools to investigate any error messages or warnings related to XML and XSLT rendering.
Host your XML and XSLT files on a web server rather than accessing them from the local file system. This can help overcome some security restrictions imposed by browsers.
Consider using dedicated XML and XSLT tools or libraries that provide consistent rendering across different browsers. These tools often offer more control and flexibility in handling XML and XSLT transformations.
By addressing these points, you can improve the compatibility and rendering of your XML and XSLT files across different browsers.
@@RaghavPal Thank you!
Sir, how to add some default value in xsl UI. let say i want to hard code 'Y' for field name called 'lastname' in your table based on some condition in for each.. so i just want some default value for lastname in UI based on some condition in UI table
Hi Shashank, will need to check on that, pls try online help
A bug investigation has lead me to xslt.
I have div which have onlick attribute in.
But when I use Safari browser, after processing using js, onclick attribute in div disappears.
I found in internet that many are facing this issue. But couldn't find a solution.
Onclick works fine for other browsers.
Could you help?
I will try to check on this
Awesome!
Thanks
@@RaghavPal Thank you!
Kindly continue the classes for XSLT
I will plan to add more videos
@@RaghavPal waiting
thanks for the video
You're welcome
Is it possible to convert XML to JSON using XSLT?
Can you provide some ideas on that?
Hi Esai, not too sure, will need to check online