Hi-
I am trying to run a transform on the document itself. In other words, I want to use a stylesheet to transform a node in the document. However, when I run the code below on Firefox, I get a "GENERIC: Javascript error: "Security error""... Am I doing something wrong?
Thanks!
<b:button>
Click to transform...
<e:handler event="click">
<e:variable name="stylesheet">
<c:load url="xsl/quote.xsl" />
</e:variable>
<c:transform select="id('world')" stylesheet="$stylesheet" destination="id('myDiv')" mode="lastChild" />
</e:handler>
</b:button>
<p />
<div id="myDiv">
Load contents of transformation below this line...
<hr />
</div>
Click to transform...
<e:handler event="click">
<e:variable name="stylesheet">
<c:load url="xsl/quote.xsl" />
</e:variable>
<c:transform select="id('world')" stylesheet="$stylesheet" destination="id('myDiv')" mode="lastChild" />
</e:handler>
</b:button>
<p />
<div id="myDiv">
Load contents of transformation below this line...
<hr />
</div>

c:transform
24 December, 2007 - 13:18 — yudiHi uspeople,
I am not sure if you can use c:transform in this way. I used to have data source in separate file not to put the data inside the"id('world')". Therefore, I would suggest to use XSLT transform as this way:
<c:load url="datasource.xml" />
</e:variable>
<e:variable name="stylesheet">
<c:load url="xsl/quote.xsl" />
</e:variable>
<c:transform select="$datasource" stylesheet="$stylesheet" destination="id('myDiv')" mode="lastChild" />
The datasource has to be valid xml too (put
<?xml version="1.0" encoding="UTF-8" ?>on the top of the document)It appears just fine to me.
24 December, 2007 - 15:42 — M.BosgraafIt appears just fine to me. What are the contents of id('world'). Maybe there's something in there which FireFox doesn't like.
Did you also try to run the code in IE of Opera to see if it also failed?
Hi- The problem does still
26 December, 2007 - 08:37 — uspeopleHi-
The problem does still occur for me on other browsers. I switched over to trying to do the javascript version. Can anyone see what is wrong wtih the code below? The invocation causes a Backbase error in Firefox. It also causes warnings when the stylesheet is loaded.
Should a stylesheet be loaded into the modelNode, viewNode, or controller? Or can it be loaded into a variable directly? Whatever the solution, can someone please provide example code for the appropriate load and transform calls?
<div id="dest"/>
<b:toolBar>
<b:toolBarButton>
<e:handler event="click" type="text/javascript">
bb.command.load('xsl/quote.xsl','GET',null,null,bb.document.getElementById('ss').modelNode,'replaceChildren',null,null,null,false);
ss=bb.xml.serialize(bb.document.getElementById('ss').modelNode);
alert(ss);
bb.command.transform(bb.document.getElementById('details').modelNode,bb.document.getElementById('ss').modelNode,null,bb.document.getElementById('dest').modelNode);
dest=bb.xml.serialize(bb.document.getElementById('dest').modelNode); alert(dest);
</e:handler>
<img src="img/save.jpg" />
Save changes
</b:toolBarButton>
</b:toolBar>
The style sheet does nothing:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:b="http://www.backbase.com/b" xmlns:c="http://www.backbase.com/c"
xmlns:e="http://www.backbase.com/e">
<xsl:template match="*">
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:stylesheet>
Thanks!
load xsl
19 May, 2008 - 15:39 — andysHi,
You can load the xsl and transform the xml by the xsl with this code below
var oProcessor = new XSLTProcessor();
oProcessor.importStylesheet(xmlStylesheetElm);
var xmlResult = oProcessor.transformToDocument(xmlData);
callback(xmlResult.documentElement);
}
);
Hope this helps,
Andys