| HTML Tutorials |
|
|
| XML Tutorials |
|
|
| Browser Scripting |
|
|
| Server Scripting |
|
|
| .NET (dotnet) |
|
|
| Multimedia |
|
|
| Web Building |
|
|
| Java Tutorials |
|
|
| Programming Langauges |
|
|
| Soft Skills |
|
|
|
|
Introduction to XSL
|
|
With the XSL you can freely do modify any of the source text. Stylesheet 1 and the
Stylesheet 2 produces the different output from a same source file.
|
XSL stylesheet 1
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="/">
<H1><xsl:value-of select="//title"/></H1>
<H2><xsl:value-of select="//author"/></H2>
</xsl:template>
</xsl:stylesheet>
|
XSL stylesheet 2
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="/">
<H2><xsl:value-of select="//author"/></H2>
<H1><xsl:value-of select="//title"/></H1>
</xsl:template>
</xsl:stylesheet>
|
|
|
An XML Syntax
|
|
An every XSL stylesheet should start with the xsl:stylesheet element. Atribute xmlns:xsl
specifies the version of the XSL(T) specification. This example do show simplest possible
stylesheet. As it do not contains any of the information, a default processing is been used.
|
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
</xsl:stylesheet>
|
|
|
An XSL Processor
|
|
The XSL processors parses the XML source and tries to find out the matching template rule.
If it do find it, then the instructions inside the matching template are been evaluated.
|
|
Contents of the original elements can be recovered from a original sources in two basic
ways. A Stylesheet 1 uses the xsl:value-of a construct. In this case contents of the
element is been used without any further processing. Construct an xsl:apply-templates in
the Stylesheet 2 is different. The parser further processes the selected elements, for
which the template is been defined..
|
XSL stylesheet 1
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="employee">
<B><xsl:value-of select="."/></B>
</xsl:template>
<xsl:template match="surname">
<i><xsl:value-of select="."/></i>
</xsl:template>
</xsl:stylesheet>
|
XSL stylesheet 2
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="employee">
<B><xsl:apply-templates select="firstName"/></B>
<B><xsl:apply-templates select="surname"/></B>
</xsl:template>
<xsl:template match="surname">
<i> <xsl:value-of select="."/></i>
</xsl:template>
</xsl:stylesheet>
|
|
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords xsl tutorial, html introduction, jsp introduction, css introduction, javascript introduction,
xsl examples , xsl attributes, xsl tutorials, xsl example, xsl cdata, xsl reference,
xsl elements, xsl tags, struts introduction, jsp xsl, xsl schema, c# introduction,
rss introduction, j2ee introduction, ejb introduction, xsl namespaces, xsl dtd, xsl programming,
java introduction, xsl attribute, XSL introduction, asp net introduction, asp net xsl,
xsl for each, vb net introduction, xsl vb net, xml introduction, xslt introduction,
xpath introduction, xslt intro
|
|
| HTML Quizes |
|
|
| XML Quizes |
|
|
| Browser Scripting Quizes |
|
|
| Server Scripting Quizes |
|
|
| .NET (dotnet) Quizes |
|
|
| Multimedia Quizes |
|
|
| Web Building Quizes |
|
|
| Java Quizes |
|
|
| Programming Langauges Quizes |
|
|
| Soft Skills Quizes |
|
|
|