Applies to Oracle 9i Release 2 or later, SOA.
Sample code to demonstrate xml transformation using two string multiplication.
Within a SOA composite, xml transformation using two string multiplication.
The strings contain numeric values, so there is no exception.
1. Create the input file named: input.xml
<?xml version="1.0" encoding="UTF-8" ?>
<singleString xmlns="http://xmlns.oracle.com/singleString">
<name>35</name>
<surname>2</surname>
</singleString>
2. Create the .xsl file transformation.xsl:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:inp1="http://xmlns.oracle.com/singleString">
<xsl:template match="/">
<xsl:variable name="gfhh"
select="/inp1:singleString/inp1:name * /inp1:singleString/inp1:surname"/>
<inp1:singleString>
<inp1:surname>
<xsl:value-of select="$gfhh"/>
</inp1:surname>
</inp1:singleString>
</xsl:template>
</xsl:stylesheet>
3. Make sure you have your jdk bin directory in your path.
For example; /refresh/home/Oracle/jdk1.6.0_30/bin directory (Java Compiler)
4. Execute the following command:
java -cp ./xmlparserv2.jar oracle.xml.parser.v2.oraxsl -v input.xml transformation.xsl
Please note xmlparserv2.jar is a .jar file which is part of Oracle XDB/XML Parser library ($ORACLE_HOME/lib/xmlparserv2.jar).
5. Execution of above command will produce xml output of:
<?xml version = '1.0' encoding = 'UTF-8'?>
<inp1:singleString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:inp1="http://xmlns.oracle.com/singleString"><inp1:surname>70</inp1:surname></inp1:singleString>
This demonstrates the transformation, and the use of the variable types within the SOA composite.
SOA relies on the transformation code within the xmlparserv2.jar file.
The expected output is 70, if the input is not a whole number the output will be rounded to 2 digits.
Reference:
Sample code to demonstrate xml transformation using two string multiplication.
Within a SOA composite, xml transformation using two string multiplication.
The strings contain numeric values, so there is no exception.
1. Create the input file named: input.xml
<?xml version="1.0" encoding="UTF-8" ?>
<singleString xmlns="http://xmlns.oracle.com/singleString">
<name>35</name>
<surname>2</surname>
</singleString>
2. Create the .xsl file transformation.xsl:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:inp1="http://xmlns.oracle.com/singleString">
<xsl:template match="/">
<xsl:variable name="gfhh"
select="/inp1:singleString/inp1:name * /inp1:singleString/inp1:surname"/>
<inp1:singleString>
<inp1:surname>
<xsl:value-of select="$gfhh"/>
</inp1:surname>
</inp1:singleString>
</xsl:template>
</xsl:stylesheet>
3. Make sure you have your jdk bin directory in your path.
For example; /refresh/home/Oracle/jdk1.6.0_30/bin directory (Java Compiler)
4. Execute the following command:
java -cp ./xmlparserv2.jar oracle.xml.parser.v2.oraxsl -v input.xml transformation.xsl
Please note xmlparserv2.jar is a .jar file which is part of Oracle XDB/XML Parser library ($ORACLE_HOME/lib/xmlparserv2.jar).
5. Execution of above command will produce xml output of:
<?xml version = '1.0' encoding = 'UTF-8'?>
<inp1:singleString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:inp1="http://xmlns.oracle.com/singleString"><inp1:surname>70</inp1:surname></inp1:singleString>
This demonstrates the transformation, and the use of the variable types within the SOA composite.
SOA relies on the transformation code within the xmlparserv2.jar file.
The expected output is 70, if the input is not a whole number the output will be rounded to 2 digits.
Reference:
No comments:
Post a Comment