Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6577667
Votes 0
Synopsis wrong javax.xml.transform.TransformerConfigurationException
Category jaxp:xslt
Reported Against
Release Fixed 1.4
State 11-Closed, Verified, bug
Priority: 4-Low
Related Bugs
Submit Date 06-JUL-2007
Description
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
MS Windows / XP

A DESCRIPTION OF THE PROBLEM :
The given program fails on the following statement in the stylesheet.

    not(preceding-sibling::* or following-sibling::*)

It runs fine on the following parenthesized variant.

    not((preceding-sibling::*) or following-sibling::*)



-----------------Test.java------------------
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class Test {
   public static void main(String[] args)
        throws TransformerConfigurationException,
              TransformerException  {
    try{
       StreamSource xslt = new StreamSource(new File("test.xslt"));
       TransformerFactory fc = TransformerFactory.newInstance();
       Transformer transformer = fc.newTransformer( xslt );
    } catch (Exception e){
       System.err.println(e);
} } }

--------------------test.xslt--------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xlink="http://www.w3.org/1999/xlink"
   >
      <xsl:output omit-xml-declaration = "yes" />
<xsl:template match="mo" >
   <xsl:choose>
      <xsl:when test="not(preceding-sibling::* or following-sibling::*)" >
      </xsl:when>
    </xsl:choose>
</xsl:template>
</xsl:stylesheet>



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java
java Test


ERROR MESSAGES/STACK TRACES THAT OCCUR :
java Test
ERROR:  'Syntax error in 'not(preceding-sibling::* or following-sibling::*)'.'
FATAL ERROR:  'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
-----------------Test.java------------------
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class Test {
   public static void main(String[] args)
        throws TransformerConfigurationException,
              TransformerException  {
    try{
       StreamSource xslt = new StreamSource(new File("test.xslt"));
       TransformerFactory fc = TransformerFactory.newInstance();
       Transformer transformer = fc.newTransformer( xslt );
    } catch (Exception e){
       System.err.println(e);
} } }

--------------------test.xslt--------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xlink="http://www.w3.org/1999/xlink"
   >
      <xsl:output omit-xml-declaration = "yes" />
<xsl:template match="mo" >
   <xsl:choose>
      <xsl:when test="not(preceding-sibling::* or following-sibling::*)" >
      </xsl:when>
    </xsl:choose>
</xsl:template>
</xsl:stylesheet>


---------- END SOURCE ----------
Posted Date : 2007-07-06 11:27:51.0
Work Around
Use this format as indicated in the bug report:

not((preceding-sibling::*) or following-sibling::*)

Or 

not(preceding-sibling::* | following-sibling::*)
Evaluation
The fix for this issue is now available on java.net.  (jaxp.dev.java.net)
Posted Date : 2007-07-13 16:35:06.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang