'Gets called when we encounter a new xmlns attribute.
@param namespaceAndName: a (namespace, name) tuple, where name
determines which type of action to take, if the namespace matches
L{TEMPLATE_NAMESPACE}.
@param qname: ignored.
@param attrs: attributes on the element being started.'

def startElementNS(self, namespaceAndName, qname, attrs):

    filename = self.sourceFilename
    lineNumber = self.locator.getLineNumber()
    columnNumber = self.locator.getColumnNumber()
    (ns, name) = namespaceAndName
    if (ns == TEMPLATE_NAMESPACE):
        if (name == 'transparent'):
            name = ''
        elif (name == 'slot'):
            try:
                default = attrs[(None, 'default')]
            except KeyError:
                default = None
            el = slot(attrs[(None, 'name')], default=default, filename=filename, lineNumber=lineNumber, columnNumber=columnNumber)
            self.stack.append(el)
            self.current.append(el)
            self.current = el.children
            return
    render = None
    attrs = OrderedDict(attrs)
    for (k, v) in items(attrs):
        (attrNS, justTheName) = k
        if (attrNS != TEMPLATE_NAMESPACE):
            continue
        if (justTheName == 'render'):
            render = v
            del attrs[k]
    nonTemplateAttrs = OrderedDict()
    for ((attrNs, attrName), v) in items(attrs):
        nsPrefix = self.prefixMap.get(attrNs)
        if (nsPrefix is None):
            attrKey = attrName
        else:
            attrKey = ('%s:%s' % (nsPrefix, attrName))
        nonTemplateAttrs[attrKey] = v
    if ((ns == TEMPLATE_NAMESPACE) and (name == 'attr')):
        if (not self.stack):
            raise AssertionError(('<{%s}attr>    as    top-level    element' % (TEMPLATE_NAMESPACE,)))
        if ('name' not in nonTemplateAttrs):
            raise AssertionError(('<{%s}attr>    requires    a    name    attribute' % (TEMPLATE_NAMESPACE,)))
        el = Tag('', render=render, filename=filename, lineNumber=lineNumber, columnNumber=columnNumber)
        self.stack[(-1)].attributes[nonTemplateAttrs['name']] = el
        self.stack.append(el)
        self.current = el.children
        return
    if self.xmlnsAttrs:
        nonTemplateAttrs.update(OrderedDict(self.xmlnsAttrs))
        self.xmlnsAttrs = []
    if ((ns != TEMPLATE_NAMESPACE) and (ns is not None)):
        prefix = self.prefixMap[ns]
        if (prefix is not None):
            name = ('%s:%s' % (self.prefixMap[ns], name))
    el = Tag(name, attributes=OrderedDict(nonTemplateAttrs), render=render, filename=filename, lineNumber=lineNumber, columnNumber=columnNumber)
    self.stack.append(el)
    self.current.append(el)
    self.current = el.children
