Using Namespaces in XSLT and XPath

You can use namespaces in XSLT and XPath like

<xsl:value-of select="//a:account/b:accountType"
  xmlns:a="http://example.com/accounts"
  xmlns:b="http://example.com/types"/>

For this to work in Java the document builder must be namespace aware otherwise namespaces are stripped when parsing the document and your transformation will fail for obvious reasons.

DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
f.setNamespaceAware(true);

At least in JDK 6 the default seems to be false.