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
    Jul 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    how to get the value from XSLT by Javascript

    hi,guys! I face a challenge when ! want to get the value from the XSLT!
    the code is below:

    Code:
    <SCRIPT type="text/javascript">
    var info="<xsl:value-of select='Content/report_content/report_content_value' />";//I have an xml file
    //??? I don't know how to get the value,I just want to get it handily
    // maybe i use the wrong method 
    //var info="report_content"; //if do it like this ,it's ok
    document.write(info);
    </SCRIPT>
    could you help me ? Thank you!
    Last edited by hi_Robert; 07-06-2011 at 08:25 AM.

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,132
    Thanks
    12
    Thanked 332 Times in 328 Posts
    if you need just that one value, you’d better use the DOM (i.e. .getElementsByTagName()), otherwise you would have to write a complete XSL file/string and process that through XSLT (which is not uniform throughout all browsers, I think). you may also try some XPath expressions on the XML directly, but the implementations thereof ain’t likely to be uniform in each browser either.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • Users who have thanked Dormilich for this post:

    hi_Robert (07-06-2011)

  • #3
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    first of all,thank you for your answer!I have written a complete XSL file ,and I want to use XSL file which involve javascript statements to create a html. during this process,the javascript statements find out the special symbol,and do some transformations. i will follow you,and use the DOM! i just want to know if there is other method to solve this problem.


    Quote Originally Posted by Dormilich View Post
    if you need just that one value, you’d better use the DOM (i.e. .getElementsByTagName()), otherwise you would have to write a complete XSL file/string and process that through XSLT (which is not uniform throughout all browsers, I think). you may also try some XPath expressions on the XML directly, but the implementations thereof ain’t likely to be uniform in each browser either.


  •  

    Tags for this Thread

    Posting Permissions

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