Subject: RE: Embedding XSL in JavaScript
From: "XSLList" <xsllist@xxxxxxxxxxxxx>
Date: Wed, 5 Mar 2003 14:12:29 -0500
|
John,
I've taken 5 and built a (cheesy) example to do what you're talking about.
This example using selectSingleNode directly against the source without a
stylesheet.
http://home.earthlink.net/~xsllist/getcust.htm
http://home.earthlink.net/~xsllist/customer.xml
Use 'John Doe' as a search criteria as I haven't added case-insensitivity or
error-handling. All disclaimers about quality of hastily-prepared examples
apply!
Jeff
>Great Brian what I meant is I have the the following
>javascript function and
>I would like to perform Xpath functions such as sum() and
>return a value
>into say a field. So I wondered if it was possible to embed
>XSL into the
>code in some way?
>
>function Search()
> {
> try
> {
> /****************************************************************
> This section is to input a value from Accno.value
> search and then populate the fields
> *****************************************************************/
> var strSearchValue = Accno.value;
> var strSearchXPath2 = "INVOICE/DETAILS[@ACCNO='"
>+strSearchValue +
>"']"
> var y;
> y=docInvoice.getElementsByTagName(strSearchXPath2);
> //Assign values to fields
> txtCustomer.value = y.item(0).getAttribute("CUSTOMER");
> txtAddress.value = y.item(0).getAttribute("ADDRESS");
> txtCity.value = y.item(0).getAttribute("City");
> txtState.value = y.item(0).getAttribute("STATE");
> txtZip.value = y.item(0).getAttribute("ZIP");
> }
> catch (error)
> {
> alert("An error occured in the function Search() The error was:" +
>error.description);
> }
>}
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Embedding XSL in JavaScript
- John Proctor - Wed, 5 Mar 2003 07:36:53 -0500 (EST)
- <Possible follow-ups>
- Martinez, Brian - Wed, 5 Mar 2003 09:36:57 -0500 (EST)
- Mac Rost - Wed, 5 Mar 2003 09:42:22 -0500 (EST)
- John Proctor - Wed, 5 Mar 2003 12:02:11 -0500 (EST)
- XSLList - Wed, 5 Mar 2003 14:09:29 -0500 (EST) <=
- Mac Martine - Wed, 12 Mar 2003 13:18:18 -0500 (EST)
- Mac Martine - Wed, 12 Mar 2003 14:13:48 -0500 (EST)
- Mike Brown - Wed, 12 Mar 2003 14:35:19 -0500 (EST)
- XSLList - Wed, 12 Mar 2003 15:20:20 -0500 (EST)
|
|