O'Reilly logo

XML Companion, The, Third Edition by Neil Bradley

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 and copying elements

Perhaps the most significant task a stylesheet performs is the generation of XML output, including element tags. XSLT includes further methods for creating elements, and for copying elements from the source document directly to the output document.

Create element

An element can be created in the output document using the Element element, with the element name specified using the Name attribute, and an optional namespace specified using the Namespace attribute. At first, there appears to be little point to this, as the following two examples are equivalent, and the first is easier to create and interpret:

<template match="section">
  <html:H3>
    <apply-templates/>
  </html:H3>
</template>


<template match="section">
  <element ...

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