The title might be misleading but i couldnt come up with something more descriptive.
Anyway i will try and explain my problem as good as i can:
I retrieve data from a xml coming from a webservice, which i have an xslt iterate through and build up the page with using the information stored in the xml.
Each node in the xml represents a "job" in a job listing. Each node can have more than one of the same childnode (i hope i use the correct words, remember i am talking about xml right now). For example, a job can have several job regions, so if i have a for-each that prints out its job regions it prints out all of them, so far so good. Problem is, on some occasions the same region can be dublicated in the xml file having the same region printed out multiple times.
This is where i need some help.
Here is a simplified version of the xml im using:
<Job> (there's several of these in each xml document) <Regions> <JobRegion> (Each "Job" can have more than one) <RegionID>123</RegionID> <Name>Some Region</Name> </JobRegion> </Regions> </Job>
So if there is for example one "JobRegion" with id 123, and two with ID 456, how can i get just one of each?
thank you for your reply, i tried looking through the examples but i find them somewhat difficult to understand, because i think mine is more simple. Its not umbraco nodes or anything, just a regular xml document.
<ArrayOfJob> <Job> (there's several of these in each xml document) ....other information that a job can contain.... <Regions> <JobRegion> (Each "Job" can have more than one of these) <RegionID>123</RegionID> <Name>Some Region</Name> </JobRegion> </Regions> </Job> </ArrayOfJob>
I only need one of each of the "JobRegion" if there's duplicates.
First match in a for-each loop, but with a twist
The title might be misleading but i couldnt come up with something more descriptive.
Anyway i will try and explain my problem as good as i can:
I retrieve data from a xml coming from a webservice, which i have an xslt iterate through and build up the page with using the information stored in the xml.
Each node in the xml represents a "job" in a job listing. Each node can have more than one of the same childnode (i hope i use the correct words, remember i am talking about xml right now).
For example, a job can have several job regions, so if i have a for-each that prints out its job regions it prints out all of them, so far so good. Problem is, on some occasions the same region can be dublicated in the xml file having the same region printed out multiple times.
This is where i need some help.
Here is a simplified version of the xml im using:
<Job> (there's several of these in each xml document)
<Regions>
<JobRegion> (Each "Job" can have more than one)
<RegionID>123</RegionID>
<Name>Some Region</Name>
</JobRegion>
</Regions>
</Job>
So if there is for example one "JobRegion" with id 123, and two with ID 456, how can i get just one of each?
Hi Frederik
If you will need to do some grouping in XSLT using the muenchian method to achieve the above I think.
You can see an example of muenchian grouping done by Chriztian in this post based on umbraco generated XML: http://our.umbraco.org/forum/developers/xslt/17142-Simple-Muenchian-grouping#comment64260
Tommy poulsen has written a bit about it here as well: http://blackpoint.dk/umbraco-workbench/xslt/grouping--distinct-values.aspx?p=3
Hope this helps.
/Jan
thank you for your reply, i tried looking through the examples but i find them somewhat difficult to understand, because i think mine is more simple. Its not umbraco nodes or anything, just a regular xml document.
I only need one of each of the "JobRegion" if there's duplicates.
is working on a reply...