![]() |
|
#1
|
||||
|
||||
[Tutorial] XSL Basics Pt. IIIOk this is the final part of my XSL article. Today I'm going to teach you about three new elements in XSL. The sort, if, and choose elements.
Today lesson will only work in IE 6 or Netscape 6 so if you’re using IE 5 or below you will not be able to use these elements. Ok the first element that we’re going to look at is the sort element. The <xsl:sort> element is used just how it sounds. It’s used to sort the output. To output the XML file as an HTML file, and sort it, simply add the sort element inside the for-each element in your XSL file: HTML Code:
Next we will look at the if element <xsl:if> the if element contains a template that will be applied only if a specified condition is true. to use the if element simply add <xsl:if> element to your XSL file like so: HTML Code:
Here an example: HTML Code:
Finally we look a the choose element <xsl:choose> the choose element is used in conjunction with <xsl:when> and <xsl:otherwise> to express multiple conditional tests. To use choose to test against the content on the XML file, simple add the <xsl:choose>,<xsl:when>, and <xsl:otherwise> elements to your XSL file: HTML Code:
HTML Code:
The above code will add a grey background color to the title WHEN the price of the game is higher than 10. Please note that the elements that we just looked at WILL NOT work in IE 5 or lower. The "http://www.w3.org/TR/WD-xsl" namespace does not understand these elements. Well that does it for my article on XSL. This is by no means all there is to XSL there is a lot more to XSL this is just a little taste to let you see what XSL is and how it works. I will be writing more about XSL in the further sometime. XSL as a bright future ahead of itself and I believe that one day it will become a very important and useful tool as for now I've learned that XSL is more for learn and exploring that using. Although XSL is fun and easy to work with it still as support problems for most Webmaster having a web Page that’s viewable by all is one of the important things and XSL does allow this. But one day XSL will be far more useful. But until then it’s always fun to learn something new. [gid=http://www.desilva.biz/forum/viewtopic562.php]XSL Basics Pt. I[/gid] __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#2
|
||||
|
||||
|
Ok that does it for my article on XSL. The article isn't completely done in the fact that I'm going to put up some examples and I'm going to double check and make sure that the article is correct. I have to make a few edits to some of the article in the way that it was written. This was the first time that I have posted an article this way and more of a test to see how it went and I've learned from this article. One of the mistakes I think was writing this article in three parts I think next time I will write the article in full and then post it in different parts. So I will have to ask you to bear with me on this, this was a learning experience and it will improve the next time around.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] XSL Basics Pt. I | pcxgamer | Web Design Forum | 15 | 22-Apr-2003 06:59 |
| [Tutorial] XSL Basics Pt. II | pcxgamer | Web Design Forum | 0 | 21-Apr-2003 07:11 |
| [Tutorial] MySQL Basics | nniehoff | MySQL / PHP Forum | 15 | 23-Mar-2003 19:42 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The