Generate another version of DocBook for your customer

Sometimes you want to generate a different version of your docbook for your customer. In my case, I was using the common attribute role to mark the content that I don't want the customer to see. Therefore, I set role="NotForClient" on all nodes that I don't want my customer to see. Then, I apply an XSL stylesheet to remove those nodes.

Here is the XSL stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:fo="">
  <!-- Copy everything -->
  <xsl:template match="@*|node()">
      <xsl:apply-templates select="@*|node()"/>
  In order to remove all nodes that has the attribute role="NotForClient",
  write a template as below to catch all nodes with @role='NotForClient' and do nothing.
  Therefore, the node is removed.
  <xsl:template match="*[@role='NotForClient']" />