javax.xml.transform.TransformerException: attribute-set named #TEXT_ALIGN# does not exist

Oracle Community | 538097 | 10 years ago
  1. 0

    Problems with PDF printing, using Apache FOP!

    Oracle Community | 10 years ago | 538097
    javax.xml.transform.TransformerException: attribute-set named #TEXT_ALIGN# does not exist
  2. 0

    I'm trying to use the updated version of Xalan (2.7.2) in secure mode and having issue with it not able to understand unknown attributes. The problem is, it prevents you from using any stylesheet that emits XHTML (in secure processing mode) because it disallows things like “colspan” attributes of “th” elements. The associated changed file is here: http://svn.apache.org/viewvc/xalan/java/branches/xalan-j_2_7_1_maint/src/org/apache/xalan/processor/XSLTElementProcessor.java?r1=1359736&r2=1581058&pathrev=1581058&diff_format=h See the following example: {code:java} import javax.xml.XMLConstants; import javax.xml.transform.*; import javax.xml.transform.stream.StreamSource; import java.io.StringReader; public class XalanSecureAttributeRepro { private static final String XSL = "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" + " <xsl:output method=\"html\"/>\n" + " <xsl:template match=\"/*\">\n" + " <th colspan=\"2\"/>\n" + " </xsl:template>\n" + "</xsl:stylesheet>"; public static void main( String[] args ) throws Exception { System.setProperty( "javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl" ); TransformerFactory tf = TransformerFactory.newInstance(); tf.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true); tf.setErrorListener( new DefaultErrorHandler( true ) ); final Source source = new StreamSource( new StringReader( XSL ) ); Templates templates = tf.newTemplates( source ); // throws: // TransformerException: "colspan" attribute is not allowed on the th element! } } {code} It returns this error: {code} Exception in thread "main" javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXException: "colspan" attribute is not allowed on the th element! javax.xml.transform.TransformerException: "colspan" attribute is not allowed on the th element! at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:933) at com.l7tech.example.XalanSecureAttributeRepro.main(XalanSecureAttributeRepro.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXException: "colspan" attribute is not allowed on the th element! javax.xml.transform.TransformerException: "colspan" attribute is not allowed on the th element! at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:925) ... 6 more Caused by: org.xml.sax.SAXException: "colspan" attribute is not allowed on the th element! javax.xml.transform.TransformerException: "colspan" attribute is not allowed on the th element! at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:919) at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:947) at org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:347) at org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:267) at org.apache.xalan.processor.ProcessorLRE.startElement(ProcessorLRE.java:283) at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:623) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:917) ... 6 more Caused by: javax.xml.transform.TransformerException: "colspan" attribute is not allowed on the th element! at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:904) ... 22 more {code} This worked properly in 2.7.1 Am I missing setting a feature on the transformer factory. How would you transform a stylesheet that emits (X)HTML in secure processing mode using Xalan?

    Apache's JIRA Issue Tracker | 2 years ago | Victor Kazakov
    javax.xml.transform.TransformerException: "colspan" attribute is not allowed on the th element!
  3. 0

    URGENT HELP! - The prefix "xsi" for attribute "xsi:type" is not bound

    Oracle Community | 1 decade ago | 843834
    javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:type" is not bound. [java]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Field label_indent not working

    Google Groups | 2 months ago | Phil Hyde
    javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntime Exception: cvc-complex-type.3.2.2: Attribute 'label_indent' is not allowed to appear in element 'field'.
  6. 0

    Field label_indent not working

    Google Groups | 2 months ago | Phil Hyde
    javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntime Exception: cvc-complex-type.3.2.2: Attribute 'label_indent' is not allowed to appear in element 'field'.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.xml.transform.TransformerException

      attribute-set named #TEXT_ALIGN# does not exist

      at org.apache.xalan.templates.ElemUse.applyAttrSets()
    2. Xalan Java
      TransformerHandlerImpl.endDocument
      1. org.apache.xalan.templates.ElemUse.applyAttrSets(ElemUse.java:168)
      2. org.apache.xalan.templates.ElemUse.execute(ElemUse.java:198)
      3. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1338)
      4. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      5. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      6. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      7. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      8. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      9. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      10. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      11. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      12. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      13. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      14. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      15. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      16. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      17. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      18. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      19. org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)
      20. org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
      21. org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2281)
      22. org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1367)
      23. org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3458)
      24. org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:406)
      24 frames
    3. org.apache.cocoon
      EnvironmentChanger.endDocument
      1. org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
      2. org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:586)
      3. org.apache.cocoon.components.EnvironmentChanger.endDocument(EnvironmentStack.java:119)
      3 frames
    4. Xerces2-j
      SAXParserImpl$JAXPSAXParser.parse
      1. org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
      2. org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
      3. org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
      4. org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
      5. org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
      6. org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
      7. org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      8. org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      9. org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      10. org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      11. org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      12. org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      12 frames
    5. org.apache.excalibur
      JaxpParser.parse
      1. org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
      2. org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:334)
      2 frames
    6. org.apache.cocoon
      CocoonServlet.service
      1. org.apache.cocoon.generation.StreamGenerator.generate(StreamGenerator.java:154)
      2. org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:579)
      3. org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:279)
      4. org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:780)
      5. org.apache.cocoon.components.source.impl.SitemapSource.toSAX(SitemapSource.java:413)
      6. org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:101)
      7. org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:321)
      8. org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116)
      9. org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:572)
      10. org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:279)
      11. org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:481)
      12. org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:121)
      13. org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
      14. org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:104)
      15. org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
      16. org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
      17. org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
      18. org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
      19. org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
      20. org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
      21. org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
      22. org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
      23. org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
      24. org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
      25. org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
      26. org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
      27. org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
      28. org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
      29. org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
      30. org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
      31. org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
      32. org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
      33. org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:253)
      34. org.apache.cocoon.Cocoon.process(Cocoon.java:699)
      35. org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
      35 frames
    7. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      1 frame
    8. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
      8 frames
    9. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      3 frames
    10. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:595)
      1 frame