logo       

DO NOT REPLY [Bug 18377] New: - XSLTC error in complex xsl:if statemen: msg#00249

Subject: DO NOT REPLY [Bug 18377] New: - XSLTC error in complex xsl:if statement
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=18377>.
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=18377

XSLTC error in complex xsl:if statement

           Summary: XSLTC error in complex xsl:if statement
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: xalan-dev@xxxxxxxxxxxxxx
        ReportedBy: foxyshadis@xxxxxxxxxxx


Input stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 version="1.0"
 xmlns:foxy="http://foxyshadis.dyndns.org";
 xmlns:dt="http://exslt.org/dates-and-times";
 exclude-result-prefixes="xalan str foxy dt func redirect exslt"
 xmlns:xalan="http://xml.apache.org/xalan";
>

<xsl:variable name="rawtext">
<xsl:apply-templates select="//entry" mode="grab">
<xsl:sort select="@date" data-type="text" order="descending"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="text" select="xalan:nodeset($rawtext)"/>

<xsl:template match="*" mode="grab">
<xsl:copy><xsl:apply-templates select="@*|node()" mode="grab"/></xsl:copy>
</xsl:template>

<xsl:template match="@*" mode="grab">
<xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>

<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="$text" mode="post"/>
</body>
</html>
</xsl:template>

<xsl:template match="entry" mode="post">
<xsl:variable name="pos" select="position()"/>
<xsl:choose>
<xsl:when test="$pos=1">
Newday- <xsl:value-of select="dt:date(@date)"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="dt:date(@date)!=dt:date($text/entry[$pos - 1]/@date[1])">
Newday- <xsl:value-of select="dt:date(@date)"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>

Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<entries>
<entry date="2003-03-25T07:30:00"/>
<entry date="2003-03-23T14:00:00"/>
<entry date="2003-03-21T17:30:00"/>
<entry date="2003-03-23T18:00:00"/>
<entry date="2003-03-21T16:30:00"/>
<entry date="2003-03-25T08:30:00"/>
</entries>

Command strings:
java org.apache.xalan.xslt.Process -xsl 
c:/fox/text/foxy/journal/test-problem-2.xsl -in 
c:/fox/text/foxy/journal/test-problem-2.xml
java org.apache.xalan.xslt.Process -xsltc -xt -xo xjournal_xsltc -xx -xsl 
c:/fox/text/foxy/journal/test-problem-2.xsl -in 
c:/fox/text/foxy/journal/test-problem-2.xml

Xalan output:
<html>
<body>
Newday- 2003-03-25
Newday- 2003-03-23
Newday- 2003-03-21</body>
</html>

XSLTC output:
(Location of error unknown)XSLT Error (java.lang.NoSuchMethodError): 
org.apache.xalan.xsltc.runtime.BasisLibrary.compare(
Lorg/apache/xpath/objects/XString;Lorg/apache/xpath/objects/XString;
ILorg/apache/xalan/xsltc/DOM;)Z

XSLTC output with the complex if test commented out:
<html>
  <body>
Newday- 2003-03-25</body>
</html>

The logic here is to capture all pertinent data in a variable, which is the 
turned into a nodeset and acted upon. This does seem inefficient, but it lets 
me 
do all of the sorting, authorization, and selection beforehand, without putting 
that mess into the main code. I'm assuming the DTM is optimized enough to not 
make a fuss on big chunks of text.

The big if then tests if the current date is different from last time's date.



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe