IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

XSLT with NameSpace prefixes - Not Bound issue

  • 1.  XSLT with NameSpace prefixes - Not Bound issue

    Posted Thu November 22, 2012 05:29 AM

    Hi,

    I’m not all that au fait with XSLT and I need to map data from an XML which contains NameSpaces.

    I am getting the following error:
    com.wm.pkg.xslt.util.LocalizedTransformerException: [XSL.0002.9002] JAXP: Error during transformation -
    The prefix “ns0” for element “ns0:SORequest” is not bound.; Line#: 2; Column#: 16

    The top of the XSLT is as follows:

    <xsl:stylesheet version=“1.0” xmlns:xsl=“[URL]http://www.w3.org/1999/XSL/Transform[/URL]
    xmlns:fo=“[URL]http://www.w3.org/1999/XSL/Format[/URL]
    xmlns:ns0=“[URL]http://www.clientcompany.com/Project/SalesOrder[/URL]
    exclude-result-prefixes=“fo”>

    <xsl:output method=“xml” indent=“yes”/>
    <xsl:template match=“ns0:SORequest”>
    <xsl:call-template name=“processSORequest”/>
    </xsl:template>

    I don’t understand why the prefix “ns0” is not bound as I have defined it ??

    Can anyone give me any pointers or help ??

    Cheers,
    David


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: XSLT with NameSpace prefixes - Not Bound issue

    Posted Thu November 22, 2012 08:13 AM

    I don’t have information for your query but I’m curious as to why you’re using XSLT? Is it easier to do the desired transformation in XSLT instead of in FLOW steps?


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 3.  RE: XSLT with NameSpace prefixes - Not Bound issue

    Posted Mon November 26, 2012 03:20 PM

    David,

    I looked through some working code, and the namespace in the xsl is used exactly the way you have it. Perhaps the input document has the namespace defined slightly different.

    If that’s not it, you could always remove the dependency on the ns0 namespace, match=“[local-name()=‘SORequest’]”.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 4.  RE: XSLT with NameSpace prefixes - Not Bound issue

    Posted Fri December 21, 2012 01:06 AM

    Yeah, figured it out… The namespace needs to be defined in the the root tag of the XML input to the XSLT as such:

    <?xml version="1.0"?>

    <ns0:SORequest xmlns:ns0=“[URL]http://www.clientcompany.com/Project/SalesOrder[/URL]”>

    Hey Reamon,
    Yeah I was sceptical of using XSLT at first, but, I have discovered that XSLT is so powerful and there are so many more functions available in it than just normal flow code… For example, it takes just a few lines of XSLT to sort an input XML data file to ensure that it is in the correct order.

    Just my 2 cents…


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services