• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

XMLTransform won't transform

Contributor ,
Nov 15, 2007 Nov 15, 2007

Copy link to clipboard

Copied

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?
TOPICS
Advanced techniques

Views

335

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 30, 2007 Nov 30, 2007

Copy link to clipboard

Copied

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()">
<xsl:copy>
<!-- go process children (applies to root node only) -->
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

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

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

</xsl:stylesheet>

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") />

<cfoutput>
<xmp>
#transformedXML#
</xmp>
</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 03, 2007 Dec 03, 2007

Copy link to clipboard

Copied

LATEST
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 :
<TimeLeft>P1DT2H47S</TimeLeft>

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation