![]() |
|
#1
|
||||
|
||||
[Tutorial] XSL Basics Pt. IIWelcome back in this article we are going to take a closer look at the example we made last time. An XSL style sheet consists of rules called templates the <xsl:template> element contains rules to apply when a specified node is matched. The match attribute is used to associate the template with an XML element. The match attribute can also be used to define a template for a whole branch of the XML document. (i.e. match="/")
Ok here is the style sheet from the last article: HTML Code:
<xsl:stylesheet> defines the start of the style sheet. <xsl:template> defines the start of a template. The match="/" attribute associates the template to the root of the XML document. The last two tags that are important are the two close tag for style sheet and template. The rest is the template itself. At this point we have completed the XSL Template. The template will be use to tell how we want the Information displayed but right now we only have the template and no information to fill it with and that’s where the <xsl:value-of> element comes in at it extracts the value of a selected node. This element can be used to select the value of an XML element and add it to the output stream of the transformation. HTML Code:
Once you add the <xsl:value-of> element (i.e. <xsl:value-of select="title"/>) this will add content to your template. Now you have add some content to your style sheet not alot but some. This will add one line to the content. There is one thing in the <xsl:value-of select="title"/> that I feel I should explane the forward slash selects subdirectories. Next we will learn about the <xsl:for-each> it allows you to do looping in XSL. HTML Code:
The legal filter operators are: = equal != not equal < less than > greater than This would display only information matching your filter in this example that would be the developer being Relic. That does it for this article. Next time we are going to look at a few more examples of XSL these will be the sort, if, and choose. The reason that I'm not going to explain then here is that these elements will not work in IE 5 because the "http://www.w3.org/TR/WD-xsl" namespace does not understand these elements. [gid=http://www.desilva.biz/forum/viewtopic578.php]XSL Basics Pt. III[/gid] __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. Last edited by pcxgamer : 21-Apr-2003 at 07:27.
|
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] XSL Basics Pt. III | pcxgamer | Web Design Forum | 1 | 24-Apr-2003 08:04 |
| [Tutorial] XSL Basics Pt. I | pcxgamer | Web Design Forum | 15 | 22-Apr-2003 06:59 |
| [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