WSO2 ESB 4.6 xstl转换错误

时间:2015-03-04 11:38:10

标签: xml xslt wso2 wso2esb

我使用wso2 ESB 4.6,在我的代理的外部序列中我添加了一个有效负载工厂介体。这是我添加的有效负载:

 <IdentitySearchResponse xmlns="">
    <ns:IdentitySearchResponses xmlns:ns="http://www.example.org/ServicePortal/IdentitySearch/">
         <IdentitySearchResponse>
             <TelNum>1111111</TelNum>
             <Fname>aaaaaa</Fname>
             <Lname>bbbbbb</Lname>
         </IdentitySearchResponse>
         <IdentitySearchResponse>
             <TelNum>2222222</TelNum>
             <Fname>eeeeeeee</Fname>
             <Lname>ffffffff</Lname>
         </IdentitySearchResponse>
         <ERRORCODE>0</ERRORCODE>
    </ns:IdentitySearchResponses>
</IdentitySearchResponse>

我添加到注册表的xslt文件包含:

 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:ns="http://www.example.org/ServicePortal/IdentitySearch/">
<xsl:template match="/IdentitySearchResponse/ns:IdentitySearchResponses">
    <xsl:for-each select = "IdentitySearchResponse">
        <xsl:value-of select="TelNum"/>
        <xsl:value-of select="Lname>
        <xsl:value-of select="Fname"/>
    </xsl:for-each>
<xsl:value-of select="//*[local-name()='ERRORCODE']"/>
</xsl:template>
</xsl:stylesheet>

但它有一些错误,xslt转换不起作用,这是我在日志文件中得到的错误:

 TID: [0] [ESB] [2015-03-04 14:46:56,033]  WARN   {org.apache.synapse.config.SynapseConfiguration} -  Error while loading the   resource conf:/XSLTransformations/testXSLT.xslt from the remote registry.    Previously cached value will be used. Check the registry accessibility. {org.apache.synapse.config.SynapseConfiguration}
TID: [0] [ESB] [2015-03-04 14:46:56,038] ERROR     amer{org.apache.synapse.mediators.transform.XSLTMediator} -  Unable to perform XSLT transformation using : Value {name ='null', keyValue ='conf:/XSLTransformations/testXSLT.xslt'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] {org.apache.synapse.mediators.transform.XSLTMediator}
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,38]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.util.jaxp.StreamResultBuilder.getNode(StreamResultBuilder.java:87)
at org.apache.synapse.mediators.transform.XSLTMediator.performXSLT(XSLTMediator.java:298)
at org.apache.synapse.mediators.transform.XSLTMediator.mediate(XSLTMediator.java:191)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:230)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:217)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,38]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:677)
at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2116)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2022)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1114)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 17 more

1 个答案:

答案 0 :(得分:0)

您的xslt无效。您可以查看here

您在以下元素中有语法错误(标记未正确关闭)

<xsl:value-of select="Lname>

将其更改为

<xsl:value-of select="Lname"/>