Failed to compile stylesheet 1 error detected

java.util.concurrent.ExecutionException: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected. Reported here: http://sensorweb.forum.52north.org/SIR...
20:45:33.746 [pool-4-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
20:45:33.747 [pool-4-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
20:45:34.062 [pool-5-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
20:45:34.062 [pool-5-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
Error on line 555 column 15 of SensorML_Profile_for_Discovery.sch.xsl:
  SXXP0003: Error reported by XML parser: The element type
"svrl:failed-assert" must be
  terminated by the matching end-tag "</svrl:failed-assert>".
20:45:34.189 [pool-4-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Created net.sf.saxon.Controller@5b4ad2e2
20:45:34.272 [pool-6-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
20:45:34.272 [pool-6-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
20:45:34.298 [pool-7-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
20:45:34.298 [pool-7-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
20:45:34.303 [pool-9-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
20:45:34.303 [pool-9-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
20:45:34.304 [pool-10-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
20:45:34.304 [pool-10-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
20:45:34.680 [pool-10-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Created net.sf.saxon.Controller@e139e3e
20:45:34.724 [pool-9-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Created net.sf.saxon.Controller@29f9ffaa
20:45:34.725 [pool-6-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Created net.sf.saxon.Controller@2eedaaf4
20:45:34.750 [pool-7-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Created net.sf.saxon.Controller@7206eb38
21:48:52.913 [http-bio-8080-exec-7] DEBUG HarvestServiceListener - Start
harvest SOS: http://192.168.140.20:8080/52nSOSv3.5.0/sos
Warning: at xsl:stylesheet on line 150 column 2 of iso_svrl_for_xslt2.xsl:
  Running an XSLT 1 stylesheet with an XSLT 2 processor
21:48:52.922 [pool-8-thread-1] DEBUG SOSServiceHarvester - Call()!
Warning: at xsl:stylesheet on line 150 column 2 of iso_svrl_for_xslt2.xsl:
  Running an XSLT 1 stylesheet with an XSLT 2 processor
21:48:53.063 [pool-8-thread-1] DEBUG Client - GetCapabilities to be send to
SOS @ http://192.168.140.20:8080/52nSOSv3.5.0/sos : <ns:GetCapabilities
service="SOS" xmlns:ns="http://www.opengi
s.net/sos/1.0"><ns1:AcceptVersions
xmlns:ns1="http://www.opengis.net/ows/1.1"><ns1:Version>1.0.0</ns1:Version></ns1:AcceptVersions></ns:GetCapabilities>
21:48:53.064 [pool-8-thread-1] DEBUG Client - Sending request (first 100
characters): <ns:GetCapabilities service="SOS"
xmlns:ns="http://www.opengis.net/sos/1.0"><ns1:AcceptVersions xmln
21:48:53.170 [pool-8-thread-1] DEBUG Client - Client connecting via POST to
http://192.168.140.20:8080/52nSOSv3.5.0/sos
21:48:53.328 [pool-4-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
21:48:53.328 [pool-4-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
21:48:53.699 [pool-6-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
21:48:53.699 [pool-6-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
21:48:53.787 [pool-5-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
21:48:53.788 [pool-5-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
21:48:53.798 [pool-4-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Created net.sf.saxon.Controller@1454e9a7
Error on line 95 column 21 of SensorML_Profile_for_Discovery.sch.xsl:
  SXXP0003: Error reported by XML parser: An invalid XML character (Unicode:
0x0) was found
  in the value of attribute &quot;test&quot; and element is
&quot;xsl:if&quot;.
21:48:53.885 [pool-9-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
21:48:53.885 [pool-9-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
21:48:53.971 [pool-10-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
21:48:53.971 [pool-10-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
21:48:53.996 [pool-7-thread-1] INFO  SensorML4DiscoveryValidatorImpl -
Created XSL file for validation:
/srv/tomcat/temp/SensorML_Profile_for_Discovery.sch.xsl
21:48:53.996 [pool-7-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Creating transformer...
21:48:54.042 [pool-6-thread-1] DEBUG SensorML4DiscoveryValidatorImpl -
Created net.sf.saxon.Controller@1da7cb5d
21:48:54.049 [pool-8-thread-1] DEBUG PGSQLHarvestServiceDAO - >>>Database
Query: INSERT INTO service (service_url,service_type) SELECT
'http://192.168.140.20:8080/52nSOSv3.5.0/sos','SOS' WH
E

The file should only be created once, adding a random component to the name could be a workaround.

I have a requirement to load stylesheet into cache. With the following code to compile the XSLT, I get an exception:

javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.

The XSLT has no errors though attached the XSLT. Below is the XSLT

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
        <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/>
        <xsl:template match="/">
            <xsl:copy-of select='.'/>
        </xsl:template>
    </xsl:stylesheet>

I have a doubt whether at the statement InputStream stream=ClassLoader.getSystemResourceAsStream(filename); is loading the file or not.

Please help me understand why the compilation is failing; I don’t have much experience in Java

    package file;

    import java.io.InputStream;
    import java.util.HashMap;
    import java.util.Map;
    import javax.xml.transform.Source;
    import javax.xml.transform.Templates;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.URIResolver;
    import javax.xml.transform.stream.StreamSource;

    public class XSLT {

        private static Map<String, Templates> templatesMap = new HashMap<String, Templates>();

        public XSLT(){

        }
        public static void main(String[] args) throws Exception{
            XSLT xs=new XSLT();
            System.out.println(xs.readXSLT("/RemoveNamespaces.xslt"));
        }
        public String readXSLT(String filename) throws Exception{
            System.setProperty("javax.xml.transform.TransformerFactory","net.sf.saxon.TransformerFactoryImpl");
            //String result="";
            InputStream stream=XSLT.class.getResourceAsStream(filename);
            TransformerFactory xformFactory=TransformerFactory.newInstance();
            xformFactory.setURIResolver(new SimpleURIResolver());

            Source source=new StreamSource(stream);
            try{
                Templates templates=xformFactory.newTemplates(source);
            }
            catch(TransformerConfigurationException  e){
                e.printStackTrace();
            }
            templatesMap.put(filename, xformFactory.newTemplates(source));
            //return templatesMap.get(filename).toString();
            return "Dummy";
        }
    }

    class SimpleURIResolver implements URIResolver {
        public Source resolve(String href, String base) throws TransformerException {
            InputStream stream = ClassLoader.getSystemResourceAsStream(href);
            return new StreamSource(stream);
        }

    }

Problem

When attempting to use an XSL style sheet in Maximo, an error occurs

Symptom

04 Oct 2016 14:00:47:766 [DEBUG] [MXServer] [] End of input XML
04 Oct 2016 14:00:47:767 [ERROR] [MXServer] [] Failed to compile
stylesheet. 1 error detected.
javax.xml.transform.TransformerConfigurationException: Failed to
compile stylesheet. 1 error detected.
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:199)
at net.sf.saxon.TransformerFactoryImpl.newTemplates
(TransformerFactoryImpl.java:132)
at psdi.common.xsl.XSLTransformerCache.createTransformer
(XSLTransformerCache.java:106)
at psdi.common.xsl.XSLTransformerCache.getTransformer
(XSLTransformerCache.java:82)
at psdi.common.xsl.XSLTransformer.getTransformerFromPath
(XSLTransformer.java:168)
at psdi.common.xsl.XSLTransformer.transform(XSLTransformer.java:134)
at psdi.iface.migexits.ExitProcessor.mapData(ExitProcessor.java:607)
at psdi.iface.migexits.ExitProcessor.processTheseExitsIn(ExitProcessor.
java:822)
at psdi.iface.migexits.ExitProcessor._parent_processExitsIn
(ExitProcessor.java:692)
at psdi.iface.migexits.ExitProcessor.processExitsIn(ExitProcessor.java:
101)
at psdi.iface.migexits.ExitProcessor._parent_processExitsIn
(ExitProcessor.java:668)
at psdi.iface.migexits.ExitProcessor.processExitsIn(ExitProcessor.java:
87)
at psdi.iface.mic.MicService.processExternalData(MicService.java:1449)
at psdi.iface.mic.MicService.processExternalData(MicService.java:1311)
at psdi.iface.gateway.MEAGatewayBean.
secureProcessExternalDataSyncInternal(MEAGatewayBean.java:171)
at psdi.iface.gateway.MEAGatewayBean.processExternalDataSync
(MEAGatewayBean.java:81)
at psdi.iface.gateway.MEAGatewayBean.wsProcessExternalData
(MEAGatewayBean.java:318)
at psdi.iface.gateway.EJSLocalStatelessenterpriseservice_9dde8a69.
wsProcessExternalData(Unknown Source)
at psdi.iface.webservices.ESWebServiceProxy.invokeService
(ESWebServiceProxy.java:103)
at psdi.iface.webservices.JAXWSWebServiceProvider.invoke
(JAXWSWebServiceProvider.java:118)
at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at org.apache.axis2.jaxws.server.dispatcher.JavaDispatcher.
invokeTargetOperation(JavaDispatcher.java:120)
at org.apache.axis2.jaxws.server.dispatcher.ProviderDispatcher.invoke
(ProviderDispatcher.java:138)
at org.apache.axis2.jaxws.server.EndpointController.invoke
(EndpointController.java:111)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive
(JAXWSMessageReceiver.java:161)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:212)
at org.apache.axis2.transport.http.HTTPTransportUtils.
processHTTPPostRequest(HTTPTransportUtils.java:172)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost
(WASAxis2Servlet.java:1600)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service
(ServletWrapper.java:1230)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
(ServletWrapper.java:779)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest
(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget
(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:97)
at psdi.iface.servlet.MEAServletFilter.doFilter(MEAServletFilter.java:
203)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter
(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:91)
at com.ibm.tivoli.maximo.filter.MTIntegrationFilter.doFilter
(MTIntegrationFilter.java:66)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter
(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter
(WebAppFilterManager.java:960)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters
(WebAppFilterManager.java:1064)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest
(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.
java:914)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.
java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.
java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.
handleDiscrimination(HttpInboundLink.java:461)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.
handleNewRequest(HttpInboundLink.java:528)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest
(HttpInboundLink.java:314)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready
(HttpInboundLink.java:285)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.
sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.
complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.
futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback
(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions
(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.
java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)
04 Oct 2016 14:00:48:124 [DEBUG] [MXServer] []
ESWebServiceProvider — using default authentication

Cause

The file is not in the correct character encoding format.

Resolving The Problem

Open the file in a text editor and save the file as UTF-8 without BOM

[{«Product»:{«code»:»SSLKT6″,»label»:»IBM Maximo Asset Management»},»Business Unit»:{«code»:»BU059″,»label»:»IBM Software w/o TPS»},»Component»:»—«,»Platform»:[{«code»:»PF025″,»label»:»Platform Independent»}],»Version»:»7.5;7.6″,»Edition»:»»,»Line of Business»:{«code»:»LOB59″,»label»:»Sustainability Software»}}]

The error message just says that compilation failed. The first thing you need to do is to find out why. By default compiler error messages are sent to the standard error output, and it looks as if your application is not displaying this. You can capture the errors by associating an error list with the XsltCompiler, and then displaying the errors that are written to this list.

Alternatively, try compiling the stylesheet from the command line, which will (in most cases) display the same errors.

In fact, when I do this, I get 7 errors (I don’t know why you only got one).

Error at xsl:variable on line 16 column 72 of test.xsl:
XPST0080: XPath syntax error at char 9 on line 16 in {xs:int(.)}:
The type xs:int is not recognized by a Basic XSLT Processor.
Error at xsl:variable on line 16 column 72 of test.xsl:
XPST0080: SequenceType syntax error at char 0 in {xs:int}:
The type xs:int is not recognized by a Basic XSLT Processor.
Error at xsl:variable on line 20 column 72 of test.xsl:
XPST0080: XPath syntax error at char 9 on line 20 in {xs:int(.)}:
The type xs:int is not recognized by a Basic XSLT Processor.
Error at xsl:variable on line 20 column 72 of test.xsl:
XPST0080: SequenceType syntax error at char 0 in {xs:int}:
The type xs:int is not recognized by a Basic XSLT Processor.
Error at xsl:variable on line 24 column 72 of test.xsl:
XPST0080: XPath syntax error at char 9 on line 24 in {xs:int(.)}:
The type xs:int is not recognized by a Basic XSLT Processor.
Error at xsl:variable on line 24 column 72 of test.xsl:
XPST0080: SequenceType syntax error at char 0 in {xs:int}:
The type xs:int is not recognized by a Basic XSLT Processor.
Error at xsl:sequence on line 26 column 264 of test.xsl:
XPST0080: XPath syntax error at char 238 on line 26 in {…decimal($Vvar78_Price3_int)…}:
The type xs:int is not recognized by a Basic XSLT Processor.
Failed to compile stylesheet. 7 errors detected.

Saxon is enforcing a rule that’s present in the XSLT specification for «basic» (non-schema-aware) processors, which defines exactly which of the XMLSchema types are available, and the list does not include xs:int. In fact you can get around this restriction without upgrading to Saxon-SA by including the attribute saxon:allow-all-built-in-types=»yes» in the xsl:stylesheet element. The namespace prefix saxon should be bound to «http://saxon.sf.net/».

Because you only got one error, it might be that your problem is different. First find out what errors you are actually getting.

Понравилась статья? Поделить с друзьями:
  • Failed to bind to port minecraft server как исправить
  • Failed to authenticate your connection minecraft как исправить
  • Failed to authenticate your connection hypixel как исправить
  • Failed to attach update to the automation wrapper error 0x87d00215
  • Failed to attach docker event listener error connect eacces var run docker sock