public void setPrefixes ( NamespaceSupport nsSupport , boolean excludeXSLDecl ) throws TransformerException { Enumeration decls = nsSupport . getDeclaredPrefixes ( ) ; while ( decls . hasMoreElements ( ) ) { String prefix = ( String ) decls . nextElement ( ) ; if ( null == m_declaredPrefixes ) m_declaredPrefixes = new ArrayList ( ) ; String uri = nsSupport . getURI ( prefix ) ; if ( excludeXSLDecl && uri . equals ( Constants . S_XSLNAMESPACEURL ) ) continue ; // System.out.println("setPrefixes - "+prefix+", "+uri); XMLNSDecl decl = new XMLNSDecl ( prefix , uri , false ) ; m_declaredPrefixes . add ( decl ) ; } }
Copy the namespace declarations from the NamespaceSupport object . Take care to call resolveInheritedNamespaceDecls . after all namespace declarations have been added .