PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3001

*** shadow/3001 Mon Aug  6 05:43:26 2001
--- shadow/3001.tmp.3327        Mon Aug  6 05:43:27 2001
***************
*** 0 ****
--- 1,127 ----
+ +============================================================================+
+ | Array out of bounds in XPath predicate that uses the preceding-axis        |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 3001                        Product: XalanJ2                 |
+ |       Status: NEW                         Version: 2.2.x                   |
+ |   Resolution:                            Platform: Other                   |
+ |     Severity: Normal                   OS/Version: Other                   |
+ |     Priority: Other                     Component: Xalan                   |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: [EMAIL PROTECTED]                                     |
+ |  Reported By: [EMAIL PROTECTED]                                       |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ Using Xalan 2.2.D6 on Windows 2k Pro, Sun jdk 1.3.1
+ 
+ If you process the attached xml file with the attached xsl file, using the 
+ Xalan command-line interface
+ 
+   java org.apache.xalan.xslt.Process -IN bug.xml -XSL bug.xsl
+ 
+ Xalan reports:
+ 
+   XSLT Error (javax.xml.transform.TransformerException): null
+ 
+ The bug disappears (and the stylesheet works just fine) if you remove one of 
+ the two div elements from the xml input. (See the comment at the beginning of 
+ the xsl file for what it does.)
+ 
+ 
+ ------- Stack trace -------
+ 
+ javax.xml.transform.TransformerException
+         at org.apache.xalan.transformer.TransformerImpl.transformNode
+ (TransformerImpl.java:1151)
+         at org.apache.xalan.transformer.TransformerImpl.transform
+ (TransformerImpl.java:590)
+         at org.apache.xalan.transformer.TransformerImpl.transform
+ (TransformerImpl.java:1037)
+         at org.apache.xalan.transformer.TransformerImpl.transform
+ (TransformerImpl.java:1015)
+         at org.apache.xalan.xslt.Process.main(Process.java:839)
+ ---------
+ java.lang.ArrayIndexOutOfBoundsException
+         at java.lang.System.arraycopy(Native Method)
+         at 
+ org.apache.xml.dtm.ref.DTMDefaultBaseIterators$PrecedingIterator.cloneIterator
+ (DTMDefaultBaseIterators.java:1159)
+         at org.apache.xpath.axes.OneStepIterator.clone(OneStepIterator.java:86)
+         at org.apache.xpath.axes.LocPathIterator.cloneWithReset
+ (LocPathIterator.java:714)
+         at org.apache.xpath.axes.ChildTestIterator.cloneWithReset
+ (ChildTestIterator.java:130)
+         at org.apache.xpath.objects.XNodeSet.iter(XNodeSet.java:383)
+         at org.apache.xpath.objects.XNodeSet.bool(XNodeSet.java:184)
+         at org.apache.xpath.functions.FuncNot.execute(FuncNot.java:85)
+         ...
+ 
+ 
+ ------- bug.xml -------
+ 
+ <?xml version="1.0" ?>
+ <html xmlns="http://www.w3.org/TR/REC-html40";>
+   <head>
+     <title>My Title</title>
+   </head>
+   <body>
+     <div>
+       <div>
+         <table>
+           <tr>
+             <td>
+               <h1><a name="prefix_1">My Title</a></h1>
+             </td>
+           </tr>
+         </table>
+       </div>
+     </div>
+   </body>
+ </html>
+ 
+ 
+ ------- bug.xsl -------
+ 
+ <?xml version="1.0" encoding='iso-8859-1'?>
+ 
+ <!-- this stylesheet looks the first a element (html anchor) whose
+      name attribute starts with the string 'prefix_', then copies this
+      anchor to the beginning of the document (right after the body
+      start tag) and removes the anchor element from the original
+      place. the rest of the input is copied identically. -->
+ 
+ <xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+  xmlns:html="http://www.w3.org/TR/REC-html40"; >
+ 
+   <xsl:template match="@*|node()">
+     <xsl:copy>
+       <xsl:apply-templates select="@*|node()"/>
+     </xsl:copy>
+   </xsl:template>
+ 
+   <xsl:template name="beginning-of-body" >
+     <xsl:variable name="first-anchor" select="//html:a[starts-with
+ (@name, 'prefix_')][1]/@name" />
+     <xsl:if test="$first-anchor" >
+       <a name="{$first-anchor}" />
+     </xsl:if>
+   </xsl:template>
+ 
+   <xsl:template match="//html:a[starts-with(@name, 'prefix_')][not
+ (preceding::html:a[starts-with(@name, 'prefix_')])]" > 
+     <xsl:apply-templates select="node()" />
+   </xsl:template>
+ 
+   <xsl:template match="html:body" >
+     <xsl:copy>
+       <xsl:call-template name="beginning-of-body" />
+       <xsl:apply-templates select="@*|node()" />
+     </xsl:copy>
+   </xsl:template>
+ 
+ </xsl:stylesheet>
+ 
+ ------- EOF -------
\ No newline at end of file

Reply via email to