FIlter a SPRY XML file with Querystring from Parent Page

Hello All,

I'm trying to do something simple, but for the life of me I can't get it to work out for me.  I'm new to SPRY for AJAX and my javascript is next to non-existant.

I have a normal ASP page passing a URLparam to another ASP page using an externally generated XML file.  I want this external XML to use the URL param to filter its recordset.

The external XML has a normal recordset behavior and the XML is generated in a Repeat Region.

I tried to include the URL param in the XML file recordset, but I don't think this XML can see the URL param.

Looking forward to hear from some Experts!!

Who is Participating?
hieloConnect With a Mentor Commented:
It would help if you provided the XML structure and the filter parameter. But to give you an idea, lets your xml looks similar to this:
 <state abbr="CA" name="California">Hi</state>
 <state abbr="OR" name="Oregon">Bye</state>
and you want to get only California's data, then you would do it as follows:
var dsStates1 = new Spry.Data.XMLDataSet("states.xml", "/states/state[@abbr='CA']");
jkdunbarAuthor Commented:
This is the URL param I'm trying to pass to this page:

The following is a snippet of my XML:

- <pictures>
- <image>
  <image_desc>Enter a description for this image</image_desc>
  <image_unit>CFPU HQ</image_unit>

Thanks for pointing me in the right direction... maybe I can read up on this too.
jkdunbarAuthor Commented:
Got it!!!  I used this code as an example and modified it for my site:

 var params = Spry.Utils.getLocationParamsAsObject();

 var xpath = "/employees/employee";

   if ((params.lastname) && (params.firstname))
   xpath = "/employees/employee[lastname = '"+params.lastname+"' and firstname= '"+params.firstname+"']";
   var ds1 = new Spry.Data.XMLDataSet("../../data/employees-01.xml", xpath);

Works like a charm!!

I will still give you the 50 points for helping me to go in the right direction!!


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.