Jump to content

Justin Diana

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Justin Diana

  • Rank
    Newbie
  1. Hey all, I'm fairly new to "advanced" XSLT development and, of course, my current task requires just that. I have a source XML file that looks similar to: <myXML> <page id=1> <text top="504" left="75">output value</text> <text top="106" left="25">output value</text> <text top="504" left="25">output value</text> <text top="106" left="18">output value</text> <text top="325" left="32">output value</text> <text top="70" left="5">output value</text> </page> <page id=3> <text top="601" left="85">output value</text> <text top="344" left="15">output value</text> <text top="243" left="15">output value</text> <text top="243" left="48">output value</text> <text top="325" left="37">output value</text> <text top="70" left="15">output value</text> </page> <page id=2> ... (same as above) </page> </myXML> Basically, I want to rewrite it so that it's flattened out (make the page ID an attribute of the child text elements) and then sort the entire list by page first (so all the page 1s are together, page 2s are together, etc.), then sort WITHIN the page by top value (descending) and then left value (descending). So it ends up looking something like: <myXML> <text page="1" top="504" left="75">output value</text> <text page="1" top="504" left="25">output value</text> <text page="1" top="325" left="32">output value</text> <text page="1" top="106" left="25">output value</text> <text page="1" top="106" left="18">output value</text> <text page="1" top="70" left="5">output value</text> <text page="2" top="900" left="85">output value</text> <text page="2" top="564" left="15">output value</text> <text page="2" top="564" left="8">output value</text> <text page="2" top="223" left="48">output value</text> <text page="2" top="154" left="37">output value</text> <text page="2" top="11" left="15">output value</text> <text page="3" top="601" left="85">output value</text> <text page="3" top="344" left="15">output value</text> <text page="3" top="325" left="37">output value</text> <text page="3" top="243" left="15">output value</text> <text page="3" top="243" left="48">output value</text> <text page="3" top="70" left="15">output value</text> </myXML> I can get it to insert the page number as an attribute correctly, but I can't get it to THEN sort using that attribute as part of the sort criteria. I can also get it to sort based on the top attribute, but it doesn't seem to do the secondary sort by left. Any help would be much appreciated. Thanks!
×
×
  • Create New...