[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: dynamically select an element

Subject: RE: dynamically select an element
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Feb 2002 15:33:05 -0000
dynamically select
Yan,

You need to pass as a parameter the required field from the form to the XSL
stylesheet.

You can do this using Javascript on the client or ASP on the server (in a
general windows environment...)

To do this clientside, using msxml4:


==html==
<form name="searchForm" action="searchXML()">
<input type="text" id="searchVal"/>
<input type="submit"/>
</form>

==javascript==
  function searchXML()
  {
     xml  = new ActiveXObject("Msxml2.DOMDocument.4.0");
     xml.async=false;
     xml.load("yourXML.xml");

     xsl = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
     xsl.async=false;
     xsl.load("yourXSL.xsl");

     xslTemp = new ActiveXObject("Msxml2.XSLTemplate.4.0");
     xslTemp.stylesheet = xsl;

     xslProc = xslTemp.createProcessor();
     xslProc.input = xml;
     xslProc.addParameter("param1",document.searchForm.searchVal.value);
     //pull value from form

     document.write(xslProc.transform);
  }
</SCRIPT>

===xsl==
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="param1"/>

<xsl:template match="/">
  <xsl:apply-templates select="*[local-name()=$param1]"/>
</xsl:apply-templates>

........and so on


I hope this is a start

cheers


andrew


===




-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of yan bai
Sent: Tuesday, February 05, 2002 2:40 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  dynamically select an element


Hi, Gurus,

I'd like to have a form in a html page, which allows a
user to select the wanted elements to view data from
an XML file.  How can I do that?   I know someone ask
the same question in this list or somewhere else.  But
I just can find it.  Hope you can help.

Thanks so much.

Yan

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.