Add variables to XSL using JS

Source: Internet
Author: User
Tags xsl xsl file
The operation is to add a variable to XSL using Js.
Then use this variable parameter in the XSL file.
---------------------------------------------
Eg:
1. In JS:
Xmldoc = new activexobject ('msxml2. domdocument.3.0 ')
Xmldoc. async = false;
Xmldoc. Load ("../XML/context. xml ")

// The style to be declared as a free-format Style
Export Doc = new activexobject ('msxml2. freethreadeddomdocument.3.0 ')
Optional Doc. async = false;
Using Doc. Load ("../XML/context. XSL ")

VaR oxslt = new activexobject ("msxml2.20.template. 3.0 ");
Oxslt. stylesheet = synchronized Doc;
VaR oxslproc = oxslt. createprocessor ();
Oxslproc. Input = xmldoc;
// Document. All. hidguid. value is a variable on the page.
Oxslproc. addparameter ("testvalue", document. All. hidguid. value );
Oxslproc. Transform ();
// Output information
Oxslproc. output;
2. In XSL, for example:
<XSL: Param name = "testvalue"/>
<XSL: template match = "entity">
<XSL: If test = "description! = ($ Testvalue) ">
......
</XSL: If>
</XSL: Template>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.