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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.