 |
XML Transformation using ASP
This document details how a Private Label Partner using ASP on their site can translate an Aptimus XML offer stream for display. Aptimus can provide the offer stream in a variety of outputs, however due to the flexible nature of XML it is a preferred method.
Note that, the XML offer stream can be used for all forms of Private Label (Basic) / (Limited) / (Deep) depending on the level of integration intended by the Partner. For information on sending orders to Aptimus see the Order Action Specification.
Examples
In order for the consumer to view the offers on the Partner site the offer data will need to be translated from raw XML code to an output format. The items below provide examples of how this can be accomplished using ASP code.
The samples are as follows:
- xml test - Partner ASP loads XML data and an XSL file, then transforms the XML to HTML using the Partner hosted XSL template
- xml test2 - Partner ASP loads XML data and then transforms it directly into HTML using ASP
- xml test include - Partner ASP loads XML data and an XSL file, then transforms the XML to HTML using an Aptimus hosted XSL template
- xml test questions - Partner ASP loads XML data and then transforms it directly into HTML using ASP, including additional parameters and questions
Example 1 - xml test
This is one of the simpler versions because there is very little ASP code involved. This file sets default parameters for the URL from which it will retrieve the XML, and also accepts additional parameters from the request (on the URL only). An XSL file (located on the partner's site) is used to transform the XML.
In this example, the XSL template is just rendering all the data transferred but it could be modified to only include certain components and display in any format determined by the Partner. Note, that an XSL file created specifically for the partner, may also be located on the Aptimus Network and is outlined in example 3. To see a live version of this, see Display One, to see the code for it view Sample Code One. Also, view the Sample XSL Code used to generate the HTML for "Display One".
Example 2 - xml test2
This sample is similar to the previous one except, after retrieving the XML data, it uses ASP code instead of XSL to present the offers in HTML format. The ASP utilizes methods available through the Microsoft.XMLDOM object, although the partner may choose to use other objects to access the XML data.
Again, this sample also accepts parameters on the URL to vary the offers that are presented. For parameters that match questions any of the offers ask, hidden form fields will be created so that when the form is submitted those parameters will be pre-populated on the data page on the Aptimus Network. To see a live version of this, see Display Two, to see the code for it view Sample Code Two
Example 3 - xml test include
Like the previous two examples, this sample file gets the data from the Aptimus Network using the Microsoft.XMLDOM object. After getting it, a separate object (Microsoft.XMLHTTP) is used to display the data. All of the transformation is being done by Aptimus in this scenario via an Aptimus hosted XSL file. Here, the data is just presented "as is". In other words, if the data sent is in HTML format, an HTML page will be displayed. If XML data is sent, that's what the partner will see in the browser window.
The advantage of this is that the partner could put this scriptlet anywhere on their page and use an XSL template residing on the Aptimus Network to transform offers for them - this means that instead of creating a COMPLETE template for the partner that mirrors the entire partner page, we could just create an XSL template appropriate to the PORTION of the page the offers will be displayed in. To see a live version of this (without an XSL tempalte), see Display Three, to see the code for it view Sample Code Three
Example 4 - xml test questions
This sample is almost exactly the same as sample 2, except this one also displays offer questions. In addition, a few more features have been added to handle things like the sorting of questions according to the order specified in the XML and also the pre-population of form fields. To see a live version of this, see Display Four, to see the code for it view Sample Code Four
Alternatives:
Try adding parameters to the URL - for instance:
http://www.aptimus.com/technology/publishers/samples/asp/xmltestquestions.asp?first_name=your_name&state=FL
For Aptimus Publisher Use Only
©2007 All Rights Reserved
Last Updated
10/30/01
|