<p>I have an XML document with un-namespaced elements, and I want to use XSLT to add namespaces to them. Most elements will be in namespace A; a few will be in namespace B. How do I do this?</p>

Here's what I have so far:
```
```
<xsl:template match="*">
    <xsl:element name="{local-name()}" namespace="A" >
        <xsl:apply-templates />
    </xsl:element>
</xsl:template>

<xsl:template match="a-special-element">
    <B:a-special-element xmlns:B="B">
      <xsl:apply-templates />
    </B:a-special-element>
</xsl:template>
```
```
This almost works; the problem is that it's not copying attributes. From what I've read thusfar, xsl:element doesn't have a way to copy all of the attributes from the element as-is (use-attribute-sets doesn't appear to cut it).