O'Reilly logo

Special Edition Using XSLT by Michael Floyd

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

Creating Elements and Attributes

Thus far, this chapter has shown how you can control the overall style sheet using top-level elements such as <xsl:output>, create template rules and invoke them using the <apply-templates> instruction element, and get element content and attribute values using <xsl:value-of>. It’s time to look toward more interesting tasks.

When you’ve mastered the basics, the first thing you will likely want to do is begin creating your own elements and attributes for insertion into the result tree. Let’s look at the process of creating an element first.

You create a new element using <xsl:element>, like so:

<xsl:element name=”companyName”> 
      Beyond HTML 
</xsl:element> 

The name attribute provides the name for the element you ...

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