Follow by Email

mercoledì 4 maggio 2011

SOA 11g - XSLT-Transformation Error remove empty element

Applying this xslt transformation on Oracle SOA Enviroment 11g to remove empty xml element from output message

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@*|node()">
    <xsl:if test=". != '' or ./@* != ''">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>


the following error occurs at runtime on server
javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.
at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:915)
at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:502)
[...]
Caused by: java.lang.RuntimeException: oracle.xml.parser.v2.XMLAttr@14929109 xdkGetPrevNode
at oracle.xml.parser.v2.XMLNode.xdkGetPrevNode(XMLNode.java:3997)
This error doesn't occur using Jdeveloper xslt test tool.

The error in soa runtime seems determined from the evaluation of attributes.

I've solved this issue using

<xsl:apply-templates select="node()| @*"/>

instead of
<xsl:apply-templates select="@*|node()"/>

in xslt template.
I hope this could help.

Nessun commento:

Posta un commento