You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "ROSSEL Olivier (CIMPA)" <ol...@airbus.com> on 2004/04/08 15:27:16 UTC
Tracing a transformation
I have made a small transformation:
XML:
<a value="valueA"><b>valueB=1</b><b>valueB=2</b></a>
XSL:
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="a">
<p/>
</xsl:template>
But when I use Trace.java to trace
what happens during transformation, I get
a rather strange log:
---begin here---
file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl Line #6, Column #-1:
template match='/'
STARTDOCUMENT
file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl Line #7, Column #-1:
html
file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl Line #8, Column #-1:
apply-templates
Selected source node '#document', at file 'null', line #-1, column #-1
file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl Line #8, Column #-1:
apply-templates, select='null':
10001: a
file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl Line #12, Column #-1:
template match='a'
STARTELEMENT: html
file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl Line #13, Column #-1:
p
STARTELEMENT: p
ENDELEMENT: p
ENDELEMENT: html
ENDDOCUMENT
---end here---
Several things happen between the first encounter of the "html" tag
in the XSL and the effective creation of the tag "html" in the result
document.
It seems that Xalan is already resolving the "a" template before it
generates
the opening "html" tag.
My real-life problem with that is that if I wait for the "html" genration
event,
I am no longer able to find which template provoked that (because the
template
has changed in-between).
Is it a dumb question? Can anyone explain me how to solve it?