...

View Full Version : XSLT automatically client side



DJAJ
03-11-2006, 02:28 AM
Hi,

how can I make an XSLT Transformation client side automatically ??

Thanx for any help !

jkd
03-11-2006, 05:15 AM
Include the following at the top of your XML pages (after the xml prologue, if you have one):

<?xml-stylesheet type="text/xsl" href="blabla.xml"?>

Although there is no text/xsl mime-type, as I understand it IE requires it to be specified. For other browsers, the mime-type of the actually stylesheet takes precedence, so it all works out. Your XSLT document should be served with a mime-type of application/xml or text/xml, btw.

DJAJ
03-11-2006, 06:34 AM
Thanx for your reply.
I think I have to subscribe my problem more detailed.

Im trying to generate an SVG File dynamically. On a HTML-File, a user can choose his XML-File, and the browser (in this case the IE) transforms the XML to SVG.

My Idea: Load the XML File, parse it, read the nodes, an transform the selected nodes with saxon to an SVG-File.

My scriptcode till now:


function ReadFileToString(p_file_name)

function WriteStringToFile(p_string,p_file_name)

function GetXMLTags()

function ConvertXMLToSVG(p_file_name)
{
var l_source_code=ReadFileToString(p_file_name);
if(l_source_code.length) {
// here I need to transform dynamically with saxon to SVG
xml_imp=new DOMImplementation();
xml_doc=xml_imp.loadXML(l_source_code);
xml_root_node=xml_doc.getDocumentElement();

alert(GetXMLTags());
// WriteStringToFile(l_source_code,"Z:\\svg\output.svg");
}
}

Thanx !



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum