Hi Chanaka, AFAIK we can change the input xml like below
<localEntry xmlns="http://ws.apache.org/ns/synapse" key="discountPayment.xsl" type="1"><xsl:stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fn=" http://www.w3.org/2005/02/xpath-functions" xmlns:m0="http://services.samples" version="2.0" exclude-result-prefixes="m0 fn"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:template match="/"> *<Payment **xmlns=""**>* <xsl:for-each select="//Order/lunch"> <discount> <xsl:value-of select="drinkPrice"/> </discount> </xsl:for-each> </Payment> </xsl:template> </xsl:stylesheet></localEntry> Just add empty namespace to the payment element. Thanks. /Susankha. On Thu, Aug 13, 2015 at 10:19 AM, Chanaka Fernando <[email protected]> wrote: > Hi Devs, > > I am having issues with axiom when I am trying to retrieve OMNode from an > OMElement. Here is my code. > > OMNode nodeValue = elem.getFirstOMChild(); > > In this scenario, my "elem" variable has the following xml. > > <localEntry xmlns="http://ws.apache.org/ns/synapse" > key="discountPayment.xsl" type="1"><xsl:stylesheet xmlns:xsl=" > http://www.w3.org/1999/XSL/Transform" xmlns:fn=" > http://www.w3.org/2005/02/xpath-functions" xmlns:m0=" > http://services.samples" version="2.0" exclude-result-prefixes="m0 fn"> > <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> > <xsl:template match="/"> > *<Payment>* > <xsl:for-each select="//Order/lunch"> > <discount> > <xsl:value-of select="drinkPrice"/> > </discount> > </xsl:for-each> > </Payment> > </xsl:template> > </xsl:stylesheet></localEntry> > > > In the above xml, under the <Payment> element, I don't have any namespace > defined. I need to retrieve the first OMChile element with the above code. > But it returns the below xml for the nodeValue. > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:m0=" > http://services.samples" version="2.0" exclude-result-prefixes="m0 fn"> > <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> > <xsl:template match="/"> > *<Payment xmlns="http://ws.apache.org/ns/synapse > <http://ws.apache.org/ns/synapse>">* > <xsl:for-each select="//Order/lunch"> > <discount> > <xsl:value-of select="drinkPrice"/> > </discount> > </xsl:for-each> > </Payment> > </xsl:template> > </xsl:stylesheet> > > > Here, it adds the "http://ws.apache.org/ns/synapse" namespace to the > result. This is causing errors in the subsequent code. > > Is there any way I can get around this and retrieve the original message? > > > Thanks, > Chanaka > -- > -- > Chanaka Fernando > Senior Technical Lead > WSO2, Inc.; http://wso2.com > lean.enterprise.middleware > > mobile: +94 773337238 > Blog : http://soatutorials.blogspot.com > LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 > Twitter:https://twitter.com/chanakaudaya > Wordpress:http://chanakaudaya.wordpress.com > > > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Susankha Nirmala Software Engineer WSO2, Inc.: http://wso2.com lean.enterprise.middleware Mobile : +94 77 593 2146
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
