这是我的.xslt文件:
<?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>
当我把这部分放在我的.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>
从我的xml(WSDL)文件中隐藏 GetCityWeatherByZIP 我在控制台中看到了这些错误:
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
当我运行我的项目时,我的项目没有启动,我看到了我复制它们的所有顶级错误。 我该怎么做才能解决这个问题?
答案 0 :(得分:1)
最可能的问题是这一行:
<xsl:variable name="$rcaTrimmed"
名称中不应包含$
。它应该是这样的:
<xsl:variable name="rcaTrimmed"