Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 152567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:38:48+00:00 2026-05-11T09:38:48+00:00

I’m trying to use the Macromedia XSLTransform class to convert XML returned from Amazon

  • 0

I’m trying to use the Macromedia XSLTransform class to convert XML returned from Amazon Web Services to HTML. Here’s the PHP page that calls the transform:

<?php require_once('includes/MM_XSLTransform/MM_XSLTransform.class.php');   $restquery = 'http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=[myid]&Operation=ItemLookup&ResponseGroup=Large&ItemId=' . htmlspecialchars($_GET['asin']); $mm_xsl = new MM_XSLTransform(); $mm_xsl->setXML($restquery); $mm_xsl->setXSL('aws1.xsl'); echo $mm_xsl->Transform(); ?> 

And here’s a snippet of the aws1.xsl page

<?xml version='1.0'?> <xsl:stylesheet    version='1.0'    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'    xmlns:aws='http://webservices.amazon.com/AWSECommerceService/2006-06-07'>    <xsl:output method='html' encoding='UTF-8' omit-xml-declaration='yes'/>    <xsl:template match='aws:Item'>     <html>       <body>         <table>           <tr>             <td style='border-bottom:#C0C0C0 dotted 1px;padding:10px'>               <table cellpadding='0' cellspacing='0' style='width: 90%;padding:5px'>                 <tr>                   <xsl:if test='aws:SmallImage/aws:URL'>                     <td valign='top' width='50'>                       <img>                         <xsl:attribute name='src'>                           <xsl:value-of select='aws:SmallImage/aws:URL' disable-output-escaping='yes' />                         </xsl:attribute>                         <xsl:attribute name='border'>0</xsl:attribute>                       </img>                     </td>                   </xsl:if>                   <!-- bunch of other stuff -->                 </tr>               </table>             </td>           </tr>         </table>       </body>     </html>   </xsl:template>  </xsl:stylesheet> 

The basic code is working – I get data on the expected ASIN item back. And I know the XSL basically works because if I intentionally put an invalid attribute in I get a parser error. But what I get back is a big unformatted bunch of text instead of HTML. I’ve tried various <xsl:output method> options, but none seems to work. I thinks it’s some kind of encoding or charset problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:38:48+00:00Added an answer on May 11, 2026 at 9:38 am

    You need to create a rule to match ‘/’ or XSL will implicitly generate one for you based on a to-text conversion of the document tree.

    I would rewrite the XSL to this:

    <xsl:stylesheet    version='1.0'    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'    xmlns:aws='http://webservices.amazon.com/AWSECommerceService/2006-06-07'>    <xsl:output method='html' encoding='UTF-8' omit-xml-declaration='yes'/>    <xsl:template match='/'>     <html>       <head>...</head>       <body>         <table>           <thead>...</thead>           <tbody>             <xsl:apply-templates select='//aws:Item'/>           </tbody>         </table>       </body>     </html>   </xsl:template>    <xsl:template match='aws:Item'>     <tr>       <td>...</td>     </tr>   </xsl:template>  </xsl:stylesheet> 

    OR add this template to your existing xsl

    <xsl:template match='*|@*'> <xsl:apply-templates select='*|@*'/> </xsl:template> 

    Both templates would match document root (‘/’) which is the ONLY implicit match that XSL does. This first would make ‘/’ map to the html tag which would create a table in which each table row maps to aws:item. The second would match all nodes (and attributes), output nothing, and then attempt to match all children. The first is better if you only want to process aws:Item, the second is better if you want to process all nodes. The second may (depending on the optimization features of you xslt processor and your particular xslt document) take much longer to process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 130k
  • Answers 130k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not sure how this applies to SqlLite, but I've… May 12, 2026 at 6:06 am
  • Editorial Team
    Editorial Team added an answer See perldoc perlop. Use lt, gt, eq, ne, and cmp… May 12, 2026 at 6:06 am
  • Editorial Team
    Editorial Team added an answer var tabCount = $(tabContainer).tabs("length"); May 12, 2026 at 6:06 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.