[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-j-users
Subject:    Tracing a transformation.
From:       "ROSSEL Olivier (CIMPA)" <olivier.rossel () airbus ! com>
Date:       2004-04-07 17:15:49
Message-ID: 3997D874A598D51190A70002A56BC99510077901 () TOCOMEXC17
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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?

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2655.35">
<TITLE>Tracing a transformation.</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>I have made a small transformation:</FONT>
<BR><FONT SIZE=2>XML:</FONT>
<BR><FONT SIZE=2>&lt;a \
value=&quot;valueA&quot;&gt;&lt;b&gt;valueB=1&lt;/b&gt;&lt;b&gt;valueB=2&lt;/b&gt;&lt;/a&gt;</FONT>
 </P>

<P><FONT SIZE=2>XSL:</FONT>
<BR><FONT SIZE=2>&lt;xsl:template match=&quot;/&quot;&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;&lt;html&gt;</FONT>
<BR><FONT SIZE=2>&nbsp; &lt;xsl:apply-templates/&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;&lt;/html&gt;</FONT>
<BR><FONT SIZE=2>&lt;/xsl:template&gt;</FONT>
</P>

<P><FONT SIZE=2>&lt;xsl:template match=&quot;a&quot;&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;&lt;p/&gt;</FONT>
<BR><FONT SIZE=2>&lt;/xsl:template&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=2>But when I use Trace.java to trace </FONT>
<BR><FONT SIZE=2>what happens during transformation, I get</FONT>
<BR><FONT SIZE=2>a rather strange log:</FONT>
<BR><FONT SIZE=2>---begin here---</FONT>
<BR><FONT SIZE=2><A HREF="file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl" \
TARGET="_blank">file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl</A> Line #6, \
Column #-1: template match='/' </FONT> <BR><FONT SIZE=2>STARTDOCUMENT</FONT>
<BR><FONT SIZE=2><A HREF="file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl" \
TARGET="_blank">file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl</A> Line #7, \
Column #-1: html</FONT> <BR><FONT SIZE=2><A \
HREF="file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl" \
TARGET="_blank">file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl</A> Line #8, \
Column #-1: apply-templates</FONT> <BR><FONT SIZE=2>Selected source node '#document', \
at file 'null', line #-1, column #-1</FONT> <BR><FONT SIZE=2><A \
HREF="file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl" \
TARGET="_blank">file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl</A> Line #8, \
Column #-1: apply-templates, select='null': </FONT> <BR><FONT \
SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; 10001: a</FONT> <BR><FONT SIZE=2><A \
HREF="file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl" \
TARGET="_blank">file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl</A> Line #12, \
Column #-1: template match='a' </FONT> <BR><FONT SIZE=2>STARTELEMENT: html</FONT>
<BR><FONT SIZE=2><A HREF="file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl" \
TARGET="_blank">file:/C:/eclipse/workspace/xalan/samples/Trace/foo.xsl</A> Line #13, \
Column #-1: p</FONT> <BR><FONT SIZE=2>STARTELEMENT: p</FONT>
<BR><FONT SIZE=2>ENDELEMENT: p</FONT>
<BR><FONT SIZE=2>ENDELEMENT: html</FONT>
<BR><FONT SIZE=2>ENDDOCUMENT</FONT>
<BR><FONT SIZE=2>---end here---</FONT>
</P>

<P><FONT SIZE=2>Several things happen between the first encounter of the \
&quot;html&quot; tag</FONT> <BR><FONT SIZE=2>in the XSL and the effective creation of \
the tag &quot;html&quot; in the result document. </FONT> <BR><FONT SIZE=2>It seems \
that Xalan is already resolving the &quot;a&quot; template before it generates \
</FONT> <BR><FONT SIZE=2>the opening &quot;html&quot; tag.</FONT>
</P>

<P><FONT SIZE=2>My real-life problem with that is that if I wait for the \
&quot;html&quot; genration event,</FONT> <BR><FONT SIZE=2>I am no longer able to find \
which template provoked that (because the template</FONT> <BR><FONT SIZE=2>has \
changed in-between).</FONT> </P>

<P><FONT SIZE=2>Is it a dumb question? Can anyone explain me how to solve it?</FONT>
</P>

</BODY>
</HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic