-
July 22nd, 2005, 07:10 AM
#1
newbie question - list unique attributes
Hi,
I'm a total newbie to XML / XSl, and I've been stuck with this problem.
Would be grateful for any suggestions / pointers
The problem -
Assuming I have an xml file
<root>
<students>
<student grade="first">abc</student>
<student grade="first">def</student>
<student grade="second">ghi</student>
<student grade="third">jkl</student>
<student grade="third">mno</student>
</students>
</root>
I need to transform this into the following xml using an XSL
<root>
<grades>
<grade level="first"/>
<grade level="second"/>
<grade level="third"/>
</grades>
<students>
<student grade="first">abc</student>
<student grade="first">def</student>
<student grade="second">ghi</student>
<student grade="third">jkl</student>
<student grade="third">mno</student>
</students>
</root>
I apologize if this is a totally newbie question, but ive been at my
wits end all day, trying to get this working.
Any advice / help would be most appreciated.
Thanks,
Rags
-
July 22nd, 2005, 04:18 PM
#2
Re: newbie question - list unique attributes
Getting unique attribute or element values is a bit difficult in XSL.
You can do it by iterating across the nodes and looking along the preceding axis for any attribute values matching the current attribute value.
If you want me to be more specific, you have to be more specific. Post what you have done so far and we can talk about how to make it do what you want.
Last edited by khp; July 22nd, 2005 at 04:43 PM.
The biggest problem encountered while trying to design a system that was completely foolproof,
was, that people tended to underestimate the ingenuity of complete fools.
Douglas Adams
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|