2 Replies Latest reply on Dec 3, 2007 9:59 AM by Dinghus

    XMLTransform won't transform

    Dinghus Level 1
      Ebay API sends back an XML response that starts like this:
      <FindPopularItemsResponse xmlns="urn:ebay:apis:eBLBaseComponents">

      When I do an XMLTransform on it, nothing shows until I remove the xmlns="... portion.

      Anybody have a way to do this on the fly or someway of getting XMLTransform to work with that bit still in there?
        • 1. Re: XMLTransform won't transform
          1) create an XSL file called removeNamespacesAndPrefixes.xsl with the following code:

          <?xml version="1.0" encoding="utf-8"?>
          <xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform">

          <xsl:output method="xml" indent="no"/>

          <xsl:template match="/|comment()|processing-instruction()">
          <!-- go process children (applies to root node only) -->

          <xsl:template match="*">
          <xsl:element name="{local-name()}">
          <!-- go process attributes and children -->
          <xsl:apply-templates select="@*|node()"/>

          <xsl:template match="@*">
          <xsl:attribute name="{local-name()}">
          <xsl:value-of select="."/>


          2) create a CFM template with the following:

          <cffile action="read" file="#ExpandPath('.')#/file_with_node_namespaces_and_prefixes.xml" variable="XMLDoc">

          <cfset transformedXML = XmlTransform(XMLDoc, "removeNamespacesAndPrefixes.xsl") />

          • 2. Re: XMLTransform won't transform
            Dinghus Level 1
            Thanx. Works like a champ. Now am I to assume that where you say to process children etc I should put the code I already have in there?

            One other thing is killing me. I am rec'g this :

            I am trying to use :
            <xsl:value-of select="minutes-from-duration(TimeLeft)" />
            But I get "could not find function" error.

            Is this not implemented fully or am I doing that wrong?