Copyright by Michael Kay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Chapter 3. Stylesheet Structure

This chapter describes the overall structure of a stylesheet. In the previous chapter we looked at the processing model for XSLT and the data model for its source and result trees. In this chapter we will look in more detail at the different kinds of construct found in a stylesheet such as declarations and instructions, literal result elements, and attribute value templates.

Some of the concepts explained in this chapter are tricky; they are areas that often cause confusion, which is why I have tried to explain them in some detail. However, it's not necessary to master everything in this chapter before you can write your first stylesheet — so use it as a reference, coming back to topics as and when you need to understand them more deeply.

The topics covered in this chapter are as follows:

  • Stylesheet modules. We will discuss how a stylesheet program can be made up of one or more stylesheet modules, linked together with <xsl:import> and <xsl:include> elements.

  • The <xsl:stylesheet> (or <xsl:transform> element). This is the outermost element of most stylesheet modules, and it defines various attributes that control how other constructs in the module behave.

  • The <?xml-stylesheet?> processing instruction. This links a source document to its associated stylesheet, and allows stylesheets to be embedded directly in the source document whose style they define.

  • A brief description of the declarations found in the stylesheet, that is, the immediate children of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required