title: How to add a second element with new id?
body: <p>This should be fairly easy but I am new to XSLT and I have a hard time finding the solution. I got the following XML:</p>
  
  <pre><code>&lt;catalog&gt;
      &lt;book id="1"&gt;
          &lt;author&gt;Mike&lt;/author&gt;
          &lt;title&gt;Tomas&lt;/title&gt;
      &lt;/book&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>and I am trying to add another <code>book</code> entry on top of it and change its <code>id</code> from <code>1</code> to <code>2</code>. I have tried the following which fails to change the attribute value though.</p>
  
  <pre><code>&lt;?xml version='1.0'?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" &gt; 
  
  &lt;xsl:template match="@id"&gt;
      &lt;xsl:attribute name="id"&gt;2&lt;/xsl:attribute&gt;
      &lt;xsl:apply-templates/&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="book"&gt;
      &lt;xsl:element name="book"&gt;
          &lt;xsl:attribute name="id"&gt;1&lt;/xsl:attribute&gt;
          &lt;xsl:element name="author"&gt;author1&lt;/xsl:element&gt;
          &lt;xsl:element name="title"&gt;title1&lt;/xsl:element&gt;
      &lt;/xsl:element&gt;
      &lt;xsl:copy-of select="."/&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Any suggestions?</p>