XSL transformation by string variable (HTTPS)

Hello!


My system is:
TAMINO 3.1.1.1
Apache 1.3.22 + SSL module
Windows 2000 Professional PL + SP2
Internet Explorer 6.0 PL

I want to add possibility by dynamic define xsl stylesheet by various color, fonts, tables etc. by creating stylesheet in my string variable named “str”. I try load this stylesheet by line:

var r = client.getDocument(str)

but unfortunately this returned “zero”, in message box like this: :frowning:

alert(r.xml);

I got something like this:

<?xml version="1.0"?>
<ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xql=“http://metalab.unc.edu/xql”><ino:message ino:returndvalue=“8554”><ino:messagetext ino:code=INOXME8554">No message received</ino:messagetext></ino:message></ino:response>

It seems like one records found, but I must admit that when I have tried like this:

var r = client.getDocument(“https://darekb/tamino/database/doc/style/mystyle001.xsl); - it is stylesheet stored in TAMINO

or

var r = client.getDocument(“https://darekb/tamino/doc/mystyle001.xsl”) - it is the physical file on my hard disk

it works pretty good in both above ways!! :confused: :confused: :confused:

Can anyone help me? What is wrong in variable “str”? How can I load my variable in properly way [instead of like this: var r = client.getDocument(str)] Any other way is possible to load string stylesheet?

Thanks for support!

Best regards
Dariusz Baumann
POLAND

-------------------------------
This is my javascript

var nl = unescape(”%0D%0A");

str = ‘’;
str += ‘<?xml version="1.0"?>’ +nl;
str += ‘<xsl:stylesheet xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” version=“1.0”>’ +nl;
str += ‘<xsl:output method=“html”/>’ +nl;

str += ‘<xsl:template match="/">’ +nl;
str += ‘’ +nl;
str += ‘’ +nl;
str += ’ ’ +nl;
str += ‘<xsl:for-each select="//dok">’ +nl;

str += ‘

’ +nl;
str += ’ ’ +nl;

str += ’

’ +nl;
str += ’ ’ +nl;
str += ’ ’ +nl;
str += ’ ’ +nl;
str += ’ ’ +nl;
str += ‘’ +nl;
str += ‘</xsl:for-each>’ +nl;
str += ‘
’ +nl;
str += ’ <xsl:value-of select=“myid”/>’ +nl;
str += ’
’ +nl;
str += ’ <xsl:value-of select=“Name”/>’ +nl;
str += ’
’ +nl;
str += ’ <xsl:value-of select=“Surname”/>’ +nl;
str += ’
’ +nl;
str += ’ <xsl:value-of select=“Address”/>’ +nl;
str += ’
’ +nl;
str += ’ <xsl:value-of select=“City”/>’ +nl;
str += ’
’ +nl;
str += ’ <xsl:value-of select=“Telephone”/>’ +nl;
str += ’
’ +nl;

str += ‘’ +nl;
str += ‘’ +nl;
str += ‘</xsl:template>’ +nl;
str += ‘</xsl:stylesheet>’ +nl;

myDatabase = ‘https://darekb/tamino/database/doc’;
pageSize = 5;
var client = new TaminoClient(myDatabase, pageSize);
var x = client.query(“dok”);
var r = client.getDocument(str); <-- not work :frowning:
var z = x.DOM.transformNode(r.DOM);
div1.innerHTML = z;
----------------------

Hi Dariusz,

According to documentation the getDocument method takes one of two parameter types:
- absolute URL to a HTTP
- or relative, i.e. to get a document from Tamino by specifying the name or ino:id of the document.
In your example you are using getDocument(str) where str contains the XML document, and therefore this is not a URL. Hence the method will fail. Suggest use XMLDOM and use the loadXML() method of it to load a DOM with an XML string; then you use can use the transformNode() method to perform the styling.

Thanks for reply, Stuart Fyffe-Collins.

Yes, You are right. :slight_smile:

Before you answered me, I had looked into TaminoLib.js and I had found exactly what you wrote. So I started to use loadxml function and it is works pretty good in https connection. :slight_smile:

I still do NOT know WHY function load from microsoft xml parser with for example:

xm = new ActiveXObject(“microsoft.XMLDOM”);
xm.load(“https://darekb/tamino/database/doc?_xql=dok”); <— not work :frowning: :frowning:

It returns null!

Regards
Dariusz Baumann