Monday, 11 February 2013

XSLT mapping for xsd:any Type using Oracle Jdeveloper

XSLT mapping for xsd:any Type in  Oracle Jdeveloper

XSLT Validation Error
Cannot Map direct to 'anyType','any' or 'anyAttribute' in target.


xslt
Cause: The target Attribute value is of type xsd:anyType ; or xsd:any.
Hence XSLT mapper cannot directly map the source to target ;unless you specify during the design(Mapping)time; what Type of value(xsd:string, xsd:integer) you would like to assign to the target variable 'value' - which is declared as xsd:anyType or xsd:any in the Target Schema.Solution:
So Mapping to the target of  Type ,xsd:any / xsd:anyType invoves two step process:xslt_1

  • Right click the target attribute ns1:value and open the  "Substitution Element or Type",to select the global type you wish to substitute; say xsd:string



  • Once done,you find xsi:type as xsi:String after which you can go ahead and create the mapping to target node.


Below diagram shows how to map and the corresponding changes that occurs in source code

xslt_2
It basically adds an additional xsl:attribute tag to specify the target substitution Type along with the source value being mapped.
<xsl:attribute name="xsi:type">
<xsl:text disable-output-escaping="no">xsd:string</xsl:text>
</xsl:attribute>
Right click and Test  ; Should work
Enjoy...