Subject: Re: Problem with API
From: Michael Welter <mike@xxxxxxxxxxxxxx>
Date: Sun, 21 Apr 2002 11:14:30 -0600
|
Michael Hi,
Yes, changing the style sheet changes the behavior, and I reasonably
sure are the pieces are in place.
My app. is sending SAX events to the ContentHandler interface of the
TransformerHandlerImpl object. When I look at the DTM after the app.
calls endDocument, I see 600+ nodes in the tree. When I call getName()
on the root node I get "#document". When I call getName() on the first
child node I get a blank/null. This is the same behavior I see from
within the stylesheet.
When I call newTransformerHandler() without a stylesheet parameter, I
get a TransformerIdentityImpl object, and the incoming xml is perfectly
echoed to the output.
I'm now going to try placing a SAXFilter between my app. and the
TransformerHandler. It probably won't make a difference, but I'll try
anything now.
Mike
P.S. I bought your book yesterday--good work!
Michael Kay wrote:
Try running your code with a different stylesheet, one that does
<xsl:copy-of select="/">. This would reveal whether you are actually running
against the correct source document. I can't think of any other reason why
you should get different results from the command line and from the API.
Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael
Welter
Sent: 18 April 2002 19:20
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Problem with API
I have an xsl stylesheet that works perfect when run from the
command line
(org.apache.xalan.xslt.Process...) However, I can't get it
to work when
using the Java API.
Using the API, control is passed to the top-level template
(<xsl:template
match="/">) where the <xsl:message>'s are printed. This
top-level template
contains <xsl:apply-templates select="Trades"/>, but control
never gets to
the <xsl:template match="Trades"> template. The incoming XML
is simply
"<Trades/>".
When I change to <xsl:apply-templates/>, control is passed
from the top
level to the <xsl:template match="*"> template.
I'm reasonably certain that everything else is working
correctly. When I
call newTransformerHandler() with no parameters, the incoming
XML is echo'd
back out (<Trades/>). When I call newTransformerHandler( new
treamSource( "foo.xsl" ) ), I have the problem.
I'm using Xalan on Win2000. I just installed j2sdk1.4.0 and
removed Xalan
from the classpath, but the problem persists.
Has anyone had a similar experience?
Thanks for your help,
Mike
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
--
Michael Welter
Denver, Colorado, USA
__o Phone: +1 303 674 2575
_ \<,_ Fax: +1 303 670 1918
(_)/ (_) e-mail: mike@xxxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|