Friday, January 16, 2009

Clone for each in XSLT

Hi All,
We all know we use for each when we want to read a array.
We also have another function called as clone for each in XSLT.
Suppose u have a scenario like u want to repeat a bunch of data,with only one of the field changing.
In my scenario i have a employee information,address of the employee for both permanent and present is the same,but i want to set the flag to true for permanent and flag set to false for present.
When i get the input i get the address only once,i am mapping it twice in the XSLT.
For this i used Clone for each,and set the flag to T for Permanent addr,and F for present.

Happy learning.

Jdeveloper Extension

A very good document which gives information on Jdeveloper extensions.
http://www.oracle.com/technology/products/jdev/howtos/1013/extension/extension.html

Happy Learning

Tuesday, January 6, 2009

ora:get-Content-as-string

Hi,
In my previous post i wrote about a custom xpath function to convert a string representation of XML to a XML.
In this post lets see a function which the reverse of this.
This function can be used to convert a XML to a string.
for ex:
xsl:value-of select ="orcl:get-content-as-string(/nso:Booklist/nso:Bookdesc:desc")

Happy Learning






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