From the course: XML Essential Training
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Conditional logic
From the course: XML Essential Training
Conditional logic
- [Instructor] One of the more powerful capabilities of XSLT is the ability to apply style sheet templates based upon the values of the incoming XML data. And that's what we're going to look at in this example. So let's open up conditional_logic.xml and conditional_logic.xslt in our start folder. So this is the same XML data we've been using from the previous examples with our Java code T products. And here's our conditional_logic.xslt file. It should look a little familiar to you by now. It starts with our template tag and it matches against our items. And this is the for each tag, which I introduced in a previous example. So what I'd like to do is apply a different visual appearance to items that are available from those that are out of stock. And if you scroll up, you can see that I have a style sheet defined here in my HTML. And I have a no and yes class from my h1s based upon whether or not a item is in stock or not. So the color's going to be different. So to do this, we need to…
Contents
-
-
-
-
-
-
-
-
-
(Locked)
What is XSLT?4m 10s
-
(Locked)
Defining XSLT style sheets3m 35s
-
(Locked)
Simple XSLT4m 6s
-
(Locked)
Repeating items5m 13s
-
(Locked)
Conditional logic6m 47s
-
(Locked)
Sorting data2m 24s
-
(Locked)
XSLT in the browser6m 26s
-
(Locked)
Challenge: BusinessCard XSLT2m 44s
-
(Locked)
Solution: BusinessCard XSLT1m 57s
-
(Locked)
-
-
-