Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development

  • Print
  • + Share This
Like this article? We recommend

Beginning an XSLT Style Sheet

Every XSLT style sheet is an XML document in itself and therefore should begin with a standard XML declaration. Once that's out of the way, you must define the namespace for the style sheet.

To begin an XSLT style sheet:

  1. Type <?xml version="1.0"?> to indicate that the XSLT style sheet is an XML document.

  2. Next, type <xsl:stylesheet xmlns:xsl= " Transform" version="1.0"> to specify the namespace for the style sheet and declare its prefix (xsl).

  3. Leave a few empty lines where you will create the style sheet

  4. Type </xsl:stylesheet> to complete the style sheet.

    Figure 4

    The header for a style sheet is almost always the same. You can just copy and paste this information from one style sheet to the next.


  • There is no space in xsl:stylesheet. (It's not xsl:style sheet). Nevertheless, I do use two words to refer to style sheets when talking about them in this book (as is the convention).

  • If you use Internet Explorer 5 for XSLT processing, you'll probably have to use the following namespace declaration: <xsl:stylesheet xmlns:xsl= "">.

  • + Share This
  • 🔖 Save To Your Account