Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XSLT automatically client side

    Hi,

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

    Thanx for any help !

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 !


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •