Hi all,
I'm using ParseWorkflow.java to trace how Xalan transforms a xml doc.
I'm a little confused because the order of creating output elements and
calling templates is not so obvious. For instance, 2&3, 4&5 in the
output are not in the same order shown in the xsl file. I guess the
below order will be more understandable.
startElement "self"
start of template line="12"
startElement "child"
..................
endElement "child"
end of template line="12"
endElement "self"
This is not critical to my work. However it'll help if I can get the
idea behind this. Please cast some light on it. Thanks.
Guoliang
------------------- Trace input --------------------------------------
<?xml version="1.0"?>
<root>
<a>
<b/>
</a>
<b>
<a/>
</b>
<a>
<a/>
</a>
</root>
------------------- xsl file -------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl= "http://www.w3.org/1999/XSL/Transform"
<http://www.w3.org/1999/XSL/Transform>
version="1.0">
<xsl:template match="/">
<self>
<xsl:apply-templates select="*"/>
</self>
</xsl:template>
<xsl:template match="a">
<child>
<xsl:apply-templates select="*"/>
<grandchild1/>
</child>
</xsl:template>
<xsl:template match="b">
<grandchild>???</grandchild>
</xsl:template>
</xsl:stylesheet>
------------------- Trace output ------------------------------------
<root>
<TEMPLATE Line="6" Match="/" />
<TEMPLATE Match="*" />
<TEMPLATE Line="12" Match="a" /> ------------------------------- 2
<self> -------------------------------------------------------- 3
<TEMPLATE Line="19" Match="b" /> ---------------------------- 4
<child> ----------------------------------------------------- 5
<grandchild />
<grandchild1 />
</child>
<TEMPLATE Line="19" Match="b" />
<grandchild />
<TEMPLATE Line="12" Match="a" />
<TEMPLATE Line="12" Match="a" />
<child>
<child>
<grandchild1 />
</child>
<grandchild1 />
</child>
</self>
</root>
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<self>
<xsl:apply-templates select="*"/>
</self>
</xsl:template>
<xsl:template match="a">
<child>
<xsl:apply-templates select="*"/>
<grandchild1/>
</child>
</xsl:template>
<xsl:template match="b">
<grandchild>???</grandchild>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<root>
<a>
<b/>
</a>
<b>
<a/>
</b>
<a>
<a/>
</a>
</root>
ParseWorkflow.java