2013-02-06 3 views
0

c'est mon fichier .xslt:si la condition pour faire cacher une partie de fichier xml (WSDL) en .xslt à mule

<?xml version='1.0' ?> 
<xsl:stylesheet version="2.0" 
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
           xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
           xmlns:s="http://www.w3.org/2001/XMLSchema"> 

    <xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes" /> 
    <xsl:param name="remoteClientAddress" /> 
    <xsl:variable name="remoteClientAddressTrimmed" 
     select="substring-before(substring-after($remoteClientAddress, '/'), ':')" /> 


<xsl:template match="@*|node()"> 
    <xsl:copy copy-namespaces="yes"> 
    <xsl:apply-templates select="@*|node()"/> 
    <!-- <xsl:value-of select="$remoteClientAddressTrimmed"/> --> 
    </xsl:copy> 
</xsl:template> 



<xsl:template match="wsdl:operation[@name = 'GetCityWeatherByZIP']"> 
    <xsl:variable name="$rcaTrimmed" 
      select="substring-before(substring-after($remoteClientAddress, '/'), ':')" /> 
    <xsl:if test="$rcaTrimmed != '192.168.0.75'"> 
     <xsl:copy> 
     <xsl:apply-templates select="@* | node()" /> 
     </xsl:copy> 
    </xsl:if> 
</xsl:template> 


</xsl:stylesheet> 

Quand je mets cette partie dans mon .xslt:

 <xsl:template match="wsdl:operation[@name = 'GetCityWeatherByZIP']"> 
    <xsl:variable name="$rcaTrimmed" 
      select="substring-before(substring-after($remoteClientAddress, '/'), ':')" /> 
    <xsl:if test="$rcaTrimmed != '192.168.0.75'"> 
     <xsl:copy> 
     <xsl:apply-templates select="@* | node()" /> 
     </xsl:copy> 
    </xsl:if> 
</xsl:template> 

pour faire peau GetCityWeatherByZIP de mon xml (WSDL) fichier j'ai vu ces erreurs dans la console:

 Exception in thread "main" org.mule.module.launcher.DeploymentStartException: TransformerConfigurationException: Failed to compile stylesheet. 2 errors detected. 
     at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:174) 
     at org.mule.module.launcher.application.ApplicationWrapper.start(ApplicationWrapper.java:107) 
     at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47) 
     at org.mule.tooling.server.application.ApplicationDeployer.run(ApplicationDeployer.java:56) 
     at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:88) 
    Caused by: org.mule.api.lifecycle.LifecycleException: Failed to start inbound endpoint "endpoint.http.localhost.8085.Weather.Service" 
     at org.mule.endpoint.DefaultInboundEndpoint.start(DefaultInboundEndpoint.java:122) 
     at org.mule.construct.AbstractFlowConstruct.startIfStartable(AbstractFlowConstruct.java:317) 
     at org.mule.construct.AbstractPipeline.doStart(AbstractPipeline.java:259) 
     at org.mule.construct.AbstractFlowConstruct$2.onTransition(AbstractFlowConstruct.java:143) 
     at org.mule.construct.AbstractFlowConstruct$2.onTransition(AbstractFlowConstruct.java:139) 
     at org.mule.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:141) 
     at org.mule.construct.FlowConstructLifecycleManager.fireStartPhase(FlowConstructLifecycleManager.java:95) 
     at org.mule.construct.AbstractFlowConstruct.start(AbstractFlowConstruct.java:138) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:225) 
     at org.mule.lifecycle.RegistryLifecycleManager$RegistryLifecycleCallback.onTransition(RegistryLifecycleManager.java:276) 
     at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:155) 
     at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:126) 
     at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:80) 
     at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:120) 
     at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:94) 
     at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:90) 
     at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:72) 
     at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:64) 
     at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:249) 
     at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:151) 
     ... 4 more 
    Caused by: org.mule.api.lifecycle.InitialisationException: Failed to compile stylesheet. 2 errors detected. 
     at org.mule.module.xml.transformer.XsltTransformer.initialise(XsltTransformer.java:142) 
     at org.mule.processor.chain.AbstractMessageProcessorChain.initialise(AbstractMessageProcessorChain.java:79) 
     at org.mule.processor.chain.AbstractMessageProcessorChain.initialise(AbstractMessageProcessorChain.java:79) 
     at org.mule.endpoint.DefaultInboundEndpoint.createMessageProcessorChain(DefaultInboundEndpoint.java:163) 
     at org.mule.endpoint.AbstractEndpoint.getMessageProcessorChain(AbstractEndpoint.java:517) 
     at org.mule.endpoint.DefaultInboundEndpoint.start(DefaultInboundEndpoint.java:104) 
     ... 27 more 
    Caused by: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 2 errors detected. 
     at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:153) 
     at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:137) 
     at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:88) 
     at org.mule.module.xml.transformer.XsltTransformer$PooledXsltTransformerFactory.makeObject(XsltTransformer.java:363) 
     at org.apache.commons.pool.impl.GenericObjectPool.addObject(GenericObjectPool.java:1615) 
     at org.mule.module.xml.transformer.XsltTransformer.initialise(XsltTransformer.java:138) 
     ... 32 more 

Lorsque je lance mon projet, mon projet ne démarre pas et je vois toutes les erreurs les plus importantes que j'ai copiées. Que dois-je faire pour résoudre ce problème?

+0

Avez-vous essayé de transformer le XML en utilisant votre XSLT et l'avez trouvé selon vos attentes? Essayez d'utiliser 'not ($ rcaTrimmed = 'VOTRE_IP')' –

+0

J'ai essayé ceci: mais j'ai encore une erreur> – brelian

+0

Copier/coller l'erreur de transformation que vous obtenez. –

Répondre

1

Le plus probable est question cette ligne:

<xsl:variable name="$rcaTrimmed" 

Le nom ne doit pas avoir un $ en elle. Cela devrait être comme ceci:

<xsl:variable name="rcaTrimmed" 
Questions connexes