Tuesday, January 6, 2009

ora:parseEscapedXML

Hi,
Oracle provides a custom xpath function,which can be used to convert a string representation of a XML input to a XML ,i.e the input which you are getting is a proper XML input but has been represented as a string.
The function is ora:parseEscapedXML(String).
One workaround is when we directly use this function in the XSLT,by default it does value-of,so the value of the XML input is selected.
Ex:
When we call this function and give the output of this function to a out variable the source looks like
xsl:value-of select="orcl:parseEscapedXML(/ns0:Message/ns0:msgData)"/

So the value of the variable msgData is passed instead of the XML.

This can be overcome by
1)Create a local XSLT variable pass the output of your function to this variable.
2)Use Copy-of and copy the variable to the required output variable
For Ex:
Replace the whole of
xsl:value-of select="orcl:parseEscapedXML(/ns0:Message/ns0:msgData)"/
with
xsl:variable name="parsedMsgData" select="orcl:parseEscapedXML(/ns0:Message/ns0:msgData)"/>

xsl:copy-of select="$parsedMsgData"/


Happy Learning

1 comment:

Unknown said...

hi Ashwini,

I am new to Oracle BPEL and am facing exact issue with parseEscapedXML() function while tryong to assign the incoming string to an XML type. Can you please elaborate on this solution, i.e., the exact steps need to be done to overcomw this issue.

Thanks,
Kamal.