OK -jeg har en asp som i sin tid transformerte til WML. Det virker ikke lenger, det har noe med hvordan upcoming chunker streamen å gjøre. Men her er (alt for mye) kodeeksempel:
<% @language=javascript %><%Response.buffer = true%>
<%Response.ContentType = "text/vnd.wap.wml"%>
<%Response.Charset = "iso-8859-1"%>
<%
//Using the following document objects and texts:
var feedDoc;
var wmlStyleDoc;
var wmlText;
// feed is transformed by wmlStyle to wmlText.
// wmlText is the desired WML output, except that it contains unused
// namespaces from the transformation. These namespaces makes it invalid WML.
// Using substring function to remove the namespace.
function conditionalLoad(doc, prodURL, testURL)
{
var conditionalURL;
doc.async = false;
doc.validateOnParse = false;
doc.setProperty("ServerHTTPRequest", true);
if (Request.serverVariables("HTTP_HOST") =="127.0.0.1" )
conditionalURL = testURL
else
conditionalURL = prodURL
;
doc.load(conditionalURL)
//Check for a successful load of the XML Document.
if (doc.parseError.errorCode != 0)
{
Response.Write("<wml><card><p>Error loading: " + conditionalURL + "</p>");
Response.Write("<p>Error Code: " + doc.parseError.errorCode + "</p>");
Response.Write("<p>Reason : " + doc.parseError.reason + "</p></card></wml>");
Response.End();
};
}
//Use the MSXML 4.0 Version dependent PROGID
//MSXML2.DOMDocument.4.0 if you wish to create
//an instance of the MSXML 4.0 DOMDocument object
//MSXML 3.0 will declare the WML as UTF-16, no matter what the output from the transformation actually is.
var use3 = true;
if (use3)
{
feedDoc = Server.CreateObject("MSXML2.DOMDocument.3.0");
wmlStyleDoc = Server.CreateObject("MSXML2.DOMDocument.3.0");
}
else
{
feedDoc = Server.CreateObject("MSXML2.DOMDocument.4.0");
wmlStyleDoc = Server.CreateObject("MSXML2.DOMDocument.4.0");
}
conditionalLoad(feedDoc, "
http://upcoming.org/syndicate/venue/1198/", "
http://127.0.0.1/xslt/1198.xml");
conditionalLoad(wmlStyleDoc, "
http://www.hsjonleik.fo/xslt/upcoming-to-wml.xslt", "
http://127.0.0.1/xslt/upcoming-to-wml.xslt");
wmlText = feedDoc.transformNode(wmlStyleDoc);
// Remove the invalid namespace:
wmlText = wmlText.substring(0,100) + wmlText.substring(144);
Response.Write(wmlText);
Response.End();
%>