title: XSLT Transformation to add multiple not existing child elements
body: <p>I've got a xml document, looking like this:</p>
  
  <pre><code>&lt;p&gt;
    &lt;c1 /&gt;
    &lt;c2 /&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>The child elements c1 and c2 are optional, but for a processing step I need them to be existent. So I am trying to create a xslt stylesheet to add them as empty elements (the order of the children does not matter).</p>
  
  <p>Here is my stylesheet:</p>
  
  <pre><code>&lt;xsl:template match="@*|node()"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="p[not(c1)]"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
          &lt;c1 /&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="p[not(c2)]"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
          &lt;c2 /&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>This works fine, as long as only one of the child elements is missing. But if both are missing, only c1 is created. How do I prevent that and force the creation of both c1 and c2 (and in reality, of about 10 children)?</p>
  
  <p>Thanks.
  Jost</p>