Namespaces in stylesheets

The need for namespaces

The concept of namespaces is very important to XSLT when a stylesheet contains a mixture of XSLT rules and output document elements. It is possible, for example, to imagine the need to create an XML document that contains an element named 'template'. Without namespaces, it would be very difficult for the XSLT processor to interpret the following markup:

<template match="...">
  <template>
    <apply-templates/>
  </template>
</template>

It is an incidental detail that HTML and XSL formatting elements do not happen to clash with XSLT elements in this way. In other cases, there may be such a conflict.

It is also important for the XSLT processor to be able to distinguish between element sets. A processor ...

Get XSL companion, The now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.