PDA

View Full Version : Nested XML Data Set problems


maguskrool
09-18-2008, 10:04 AM
Hi. I'm learning to use the Spry framework and I've ran into some problems while creating nested xml data sets.

I have all the necessary .js and spry files linked. My goal is to use a data set like dsProjects4, one that is nested and that is linked to the "language" of the dsLanguages data set. That way, when the language changes, the data displayed by regions linked to dsProjects4 will change accordingly. It works if it's not a nested data set (dsProjects2), but I don't understand why it doesn't if it's nested.

Can anyone tell me what I'm doing wrong and why the nested xml data set number 4 doesn't work?

Thank you in advance.

languages.xml:


<language_list>

<language>english</language>
<language>portuguese</language>
</language_list>

projects.xml:
<project_list>
<project name="proj1">
<english>
<title>project one</title>
<date>2008</date>
</english>
<portuguese>
<title>projecto um</title>
<date>2008</date>
</portuguese>
</project>
<project name="proj2">
<english>
<title>project two</title>
<date>2008</date>
</english>
<portuguese>
<title>projecto dois</title>
<date>2008</date>
</portuguese>
</project>
</project list>

I then build the datasets on my index.html:
var dsLanguages = new Spry.Data.XMLDataSet("xml/languages.xml", "language_list/language");
var dsProjects1 = new Spry.Data.XMLDataSet("xml/projects.xml", "project_list/project");
var dsProjects2 = new Spry.Data.XMLDataSet("xml/projects.xml", "project_list/project/{dsLanguages::language}");
var dsProjects3 = new Spry.Data.NestedXMLDataSet(dsProjects1, "english");
var dsProjects4 = new Spry.Data.NestedXMLDataSet(dsProjects1, "{dsLanguages::language}");

And then I create the regions that will receive the data:
<p class="text_01" spry:region="dsProjects2">{title}</p> //displays "project one";
<p class="text_01" spry:region="dsProjects3">{title}</p> //displays "project one";
<p class="text_01" spry:region="dsProjects4">{title}</p> //displays nothing;