title: How to do a XSL transform in Java using a not namespace aware parser?
body: <p>I use <a href="http://home.ccil.org/~cowan/tagsoup/" rel="nofollow">tagsoup</a> as (SAX) <code>XMLREader</code> and set the namespace feature to <code>false</code>. This parser is used to feed the <code>Transformer</code> as SAX Source. Complete code:</p>
  
  <pre><code>    final TransformerFactory factory = TransformerFactory.newInstance();
      final Transformer t = factory.newTransformer(new StreamSource(
          getClass().getResourceAsStream("/identity.xsl")));
  
      final XMLReader p = new Parser(); // the tagsoup parser
      p.setFeature("http://xml.org/sax/features/namespaces", false);
  
      // getHtml() returns HTML as InputStream
      final Source source = new SAXSource(p, new InputSource(getHtml())); 
  
      t.transform(source, new StreamResult(System.out));
  </code></pre>
  
  <p>This results in something like:</p>
  
  <pre><code>&lt; xmlns:html="http://www.w3.org/1999/xhtml"&gt;
  &lt;&gt;
  &lt;&gt;
  &lt;&gt;
  &lt;&gt;
  &lt; height="17" valign="top"&gt;
  </code></pre>
  
  <p>Problem is that the tag names are blank. The XMLReader (tagsoup parser) does report an empty namespaceURI and empty local name in the SAX methods <code>ContentHandler#startElement</code> and <code>ContentHandler#endElement</code>. For a not namespace aware parser this is allowed (see <a href="http://docs.oracle.com/javase/7/docs/api/org/xml/sax/ContentHandler.html#startElement(java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes)" rel="nofollow">Javadoc</a>).</p>
  
  <p>If i add a <code>XMLFilter</code> which copies the value of the qName to the localName, everything goes fine. However, this is not what i want, i expect this works "out of the box". What am i doing wrong? Any input would be appreciated!</p>