You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/11/08 23:25:38 UTC
DO NOT REPLY [Bug 4755] New: -
xsltc servlet and JSP transformations interact changing sort order
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4755>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4755
xsltc servlet and JSP transformations interact changing sort order
Summary: xsltc servlet and JSP transformations interact changing
sort order
Product: XalanJ2
Version: CurrentCVS
Platform: All
OS/Version: All
Status: NEW
Severity: Major
Priority: Other
Component: org.apache.xalan.xsltc
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: tom.amiro@sun.com
This one is hard to describe. But there seems to be an interaction
between xsltc transformations performed by a JSP and a Servlet in
the same Tomcat context. Both use XSLTC's native API and use a cached DOM
created from a common xml file. The servlet does apply-templates with sorting
on date attributes (month, day, year) of the enries, whereas the JSP does
apply-templates with sorting on an ID attribute.
The inexplicable thing is that the servlet can be run any number of
times, outputting entries in html in the correct date sorted order, but
immediately after the JSP is run, the servlet begins to output entries
in ID sorted order, ignoring the sort order that was compiled into its translet.
The JSP and Servet use precompiled translets that are independent.
As a work-around, I appended a date ordered sort to the JSP's stylesheet
with the output swallowed up by a variable. The servlet now continues
to sort by date after the JSP has been run.
Here's the xsl used by the JSP:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="calendar">
<!-- <xsl:for-each select="entry"> changed to handle series elements -->
<xsl:for-each select="*">
<xsl:sort data-type="number" order="ascending" select="@ID" />
<xsl:if test="position() = last()">
<xsl:value-of select="@ID" />
</xsl:if>
</xsl:for-each>
<!-- TWA - workaround - resorting on date fixes out-of-sorts problem -->
<!--
<xsl:variable name="dummy">
<xsl:apply-templates select="*" >
<xsl:sort order="ascending" data-type="number" select="date/@year" />
<xsl:sort order="ascending" data-type="number" select="date/@month" />
<xsl:sort order="ascending" data-type="number" select="date/@day" />
<xsl:sort order="ascending" data-type="text" select="state" />
</xsl:apply-templates>
</xsl:variable>
-->
</xsl:template>
</xsl:stylesheet>
Note the apply-templates used as the work-around is what is used through
out the stylesheet (search.xsl) used by the servlet.