Solved.  setCompileWithTracing() did the trick.
 
Here's the final code:
 
File workingDir = new File( getServletContext().getRealPath("/") );
File template = new File(workingDir,"test.xsl");
File input = new File(workingDir,"test.xml");
StreamSource src = new StreamSource( input ); 
StringWriter str = new StringWriter();
StreamResult dest = new StreamResult( str );
Source source = new StreamSource( template );
TransformerFactoryImpl tranFactory = new TransformerFactoryImpl();
tranFactory.setAttribute(FeatureKeys.LINE_NUMBERING,Boolean.TRUE);
tranFactory.getConfiguration().setCompileWithTracing(true);
Transformer aTransformer = tranFactory.newTransformer( source );
((net.sf.saxon.Controller)aTransformer).addTraceListener(new net.sf.saxon.trace.XSLTTraceListener());
aTransformer.transform( src, dest );
out.println( str.toString());
 
Result appears as:
 
<trace saxon-version="9.2.0.6" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <source node="/test" line="1" file="test.xml">
  <xsl:template match="test" line="6" column="29" module="test.xsl">
   <xsl:apply-templates line="7" column="25" module="test.xsl">
    <source node="/test/hello[1]" line="2" file="test.xml">
     <xsl:template match="hello" line="10" column="30" module="test.xsl">
      <xsl:value-of select="." line="11" column="36" module="test.xsl">
      </xsl:value-of>
     </xsl:template>
    </source><!-- /test/hello[1] -->
   </xsl:apply-templates>
  </xsl:template>
 </source><!-- /test -->
</trace>
 
XSL is:
 
<xsl:stylesheet
 version="2.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >
 <xsl:output method="xml" omit-xml-declaration="yes"/>
 <xsl:template match="test">
  <xsl:apply-templates/>
 </xsl:template>
 
 <xsl:template match="hello">
  Hello: <xsl:value-of select="."/>
 </xsl:template>
</xsl:stylesheet>
 
XML is:
 
<test>
 <hello>world</hello>
</test>