< prev index next >

test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package test.gaptest;
  25 
  26 import java.io.StringReader;
  27 
  28 import javax.xml.transform.TransformerConfigurationException;
  29 import javax.xml.transform.TransformerFactory;
  30 import javax.xml.transform.stream.StreamSource;
  31 
  32 import jaxp.library.JAXPBaseTest;
  33 
  34 import org.testng.annotations.Test;
  35 
  36 /*
  37  * @bug 4511326
  38  * @summary In forwards-compatible mode the attribute isn't ignored
  39  */
  40 
  41 public class Bug4511326 extends JAXPBaseTest {
  42 
  43     private static final String XSL = "<xsl:stylesheet version='2.0' "
  44                                + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
  45                                + "<xsl:template a='1' match='/'>"
  46                                + "<H2><xsl:value-of select='//author'/></H2>"
  47                                + "<H1><xsl:value-of select='//title'/></H1>"
  48                                + "</xsl:template>"
  49                                + "</xsl:stylesheet>";
  50 
  51 
  52     @Test
  53     public void ignoreAttTest() throws TransformerConfigurationException {
  54         /* Create a TransformFactory instance */
  55         TransformerFactory transformerFactory = TransformerFactory.newInstance();
  56 
  57         /* Create and init a StreamSource instance */
  58         StreamSource source = new StreamSource(new StringReader(XSL));
  59 
  60         transformerFactory.newTransformer(source);
  61     }
   1 /*
   2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package test.gaptest;
  25 
  26 import java.io.StringReader;
  27 
  28 import javax.xml.transform.TransformerConfigurationException;
  29 import javax.xml.transform.TransformerFactory;
  30 import javax.xml.transform.stream.StreamSource;
  31 
  32 import org.testng.annotations.Listeners;

  33 import org.testng.annotations.Test;
  34 
  35 /*
  36  * @bug 4511326
  37  * @summary In forwards-compatible mode the attribute isn't ignored
  38  */
  39 @Listeners({jaxp.library.BasePolicy.class})
  40 public class Bug4511326 {
  41 
  42     private static final String XSL = "<xsl:stylesheet version='2.0' "
  43                                + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
  44                                + "<xsl:template a='1' match='/'>"
  45                                + "<H2><xsl:value-of select='//author'/></H2>"
  46                                + "<H1><xsl:value-of select='//title'/></H1>"
  47                                + "</xsl:template>"
  48                                + "</xsl:stylesheet>";
  49 
  50 
  51     @Test
  52     public void ignoreAttTest() throws TransformerConfigurationException {
  53         /* Create a TransformFactory instance */
  54         TransformerFactory transformerFactory = TransformerFactory.newInstance();
  55 
  56         /* Create and init a StreamSource instance */
  57         StreamSource source = new StreamSource(new StringReader(XSL));
  58 
  59         transformerFactory.newTransformer(source);
  60     }
< prev index next >