Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

XSL vs XSLT

Posted on 2004-11-15
4
Medium Priority
?
6,761 Views
Last Modified: 2013-11-18
A newbie here :o)

What is the differnece between XSL and XSLT - I know that XSLT is a subset language of XSL but am otherwise confused...

What would the following be:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
    <root>
        <xsl:apply-templates/>
    </root>
    </xsl:template>

    <xsl:template match="bookstore">
    <!-- Prices and books -->
        <bookstore>
            <xsl:apply-templates select="book"/>
        </bookstore>
    </xsl:template>

    <xsl:template match="book">
        <book>
            <xsl:attribute name="ISBN">
                <xsl:value-of select="@ISBN"/>
            </xsl:attribute>
            <price><xsl:value-of select="price"/></price><xsl:text>
            </xsl:text>
        </book>
    </xsl:template>

</xsl:stylesheet>

It is labeled : Using XSLT and .NET to Manipulate XML Files  but then al elements are xsl:

Thanks for helping clear the confusion!
0
Comment
Question by:mrichmon
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
J_Mak earned 2000 total points
ID: 12589596
XSL is bascically made up of two major components: XSLT (Extensible Stylesheet Language Transformations) and XSL-FO (Extensible Stylesheet Language Formatting Objects). Most of the time, everyone uses the more basic XSLT. But when everyone refers to 'XSL', usually they are just generally referring to the stylesheet. That is, generally, if I say, "this is my XSL", it's just like saying, "this is my stylesheet". It really depends on the context of what you are talking about.

Your above example would be best referred to as a 'stylesheet'. A stylesheet uses the XSLT part of XSL to create rules that govern the way an XML file will be transformed. The 'xsl:' prefix  basically refers to the URI namespace which is http://www.w3.org/1999/XSL/Transform, and this is declared at the top. When you write xsl:template, the 'template' belongs to the 'xsl' namespace that you declared. You didn't have to use 'xsl'. You could say something like:

<hello:stylesheet version="1.0" xmlns:hello="http://www.w3.org/1999/XSL/Transform">

then the stylesheet would look like:

<hello:stylesheet version="1.0" xmlns:hello="http://www.w3.org/1999/XSL/Transform">

    <hello:template match="/">
    <root>
        <hello:apply-templates/>
    </root>
    </hello:template>

    <hello:template match="bookstore">
    <!-- Prices and books -->
        <bookstore>
            <hello:apply-templates select="book"/>
        </bookstore>
    </hello:template>

    <hello:template match="book">
        <book>
            <hello:attribute name="ISBN">
                <hello:value-of select="@ISBN"/>
            </hellol:attribute>
            <price><hello:value-of select="price"/></price><hello:text>
            </hello:text>
        </book>
    </hello:template>

</hello:stylesheet>

'hello' or 'xsl' is just a meand of defining a prefix to refer to the URI http://www.w3.org/1999/XSL/Transform. I hope that clears it up. Cheers.
0
 
LVL 35

Author Comment

by:mrichmon
ID: 12589653
okay that does help a lot.

One more question then.

In general would you use an extention of .xsl or .xslt for a a file that turns xml into xhtml display?
0
 
LVL 7

Expert Comment

by:J_Mak
ID: 12589950
You should use .xsl

That is the standard extension for a stylesheet that converts an XML into any format that you want.

Cheers.
0
 
LVL 15

Expert Comment

by:dualsoul
ID: 12592487
i preffer to use XSLT for stylesheet, and .fo for FO documents.

the one problem with XSLT - is there are no standard mime-mapping for this filetypes in major web servers like Apache and IIS, so some browsers like Mozilla wouldn't interpret this file in a right way. But, probably you would never faced this case :)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question