NamespacesHandler::NamespacesHandler(
            StylesheetConstructionContext&  theConstructionContext,
            const NamespacesHandler&        /* stylesheetNamespacesHandler */,
            const NamespacesStackType&      theCurrentNamespaces,
            const XalanDOMString&           theXSLTNamespaceURI) :
    m_excludedResultPrefixes(theConstructionContext.getMemoryManager()),
    m_namespaceDeclarations(theConstructionContext.getMemoryManager()),
    m_extensionNamespaceURIs(theConstructionContext.getMemoryManager()),
    m_namespaceAliases(theConstructionContext.getMemoryManager())
{
    // Go through the namespaces stack in reverse order...
    const NamespacesStackType::const_reverse_iterator   theEnd =
        theCurrentNamespaces.rend();

    NamespacesStackType::const_reverse_iterator     i =
        theCurrentNamespaces.rbegin();

    for(; i != theEnd; ++i)
    {
        // Process each namespace in the current vector...
        const NamespaceVectorType::const_iterator   theVectorEnd =
            (*i).end();

        NamespaceVectorType::const_iterator         j =
            (*i).begin();

        for(; j != theVectorEnd; ++j)
        {
            const NameSpace&        theNamespace = *j;

            const XalanDOMString&   theURI = theNamespace.getURI();

            const XalanDOMString&   thePrefix = theNamespace.getPrefix();

            if(shouldExcludeResultNamespaceNode(
                    theXSLTNamespaceURI,
                    theURI) == false)
            {
                addByPrefix(
                    theConstructionContext,
                    m_namespaceDeclarations,
                    thePrefix,
                    theURI);
            }
            else
            {
                addByPrefix(
                    theConstructionContext,
                    m_excludedResultPrefixes,
                    thePrefix,
                    theURI);

                assert(findByPrefix(m_excludedResultPrefixes, thePrefix) != 0 &&
                       findByPrefix(m_excludedResultPrefixes, thePrefix)->getURI() == theURI);
            }
        }
    }
}
Beispiel #2
0
static struct hash* splitByPrefix(struct gbConf *conf)
/* split by prefix in to has of prefixElems  */
{
struct hash *prefixMap = hashNew(18);
struct hashEl *elems = hashElListHash(conf->hash);
struct hashEl *confEl;
while ((confEl = slPopHead(&elems)) != NULL)
    addByPrefix(prefixMap, confEl);
return prefixMap;
}