xml - XSLT 2.0 sorting with key position and zero values -
xml - XSLT 2.0 sorting with key position and zero values -
im stuck xslt sorting problem:
i'd able sort list of elements according key (weight). key position in sorted list result. problem input list has key-position values 0 , result should maintain these order when no position assigned.
example: input list:
<document> <html weight="7"><data>aaa</data></html> <news weight="5"><data>bbb</data></news> <news weight="2"><data>ccc</data></news> <asset weight="0"><data>ddd</data></asset> <news weight="0"><data>eee</data></news> <news weight="0"><data>fff</data></news> <news weight="0"><data>ggg</data></news> <news weight="0"><data>hhh</data></news> <asset weight="0"><data>iii</data></news> <html weight="0"><data>jjj</data></news> </document> goal:
<document> <asset weight="0"><data>ddd</data></asset> <news weight="2"><data>ccc</data></news> <news weight="0"><data>eee</data></news> <news weight="0"><data>fff</data></news> <news weight="5"><data>bbb</data></news> <news weight="0"><data>ggg</data></news> <html weight="7"><data>aaa</data></html> <news weight="0"><data>hhh</data></news> <asset weight="0"><data>iii</data></news> <html weight="0"><data>jjj</data></news> </document> data node content no matter in sorting algorithm.
<asset weight="0"><data>ddd</data></asset> must first "zero" weight item because there isn't weight=1 in input list. <news weight="2"><data>ccc</data></news> sec element because weight=2=position in result list. <news weight="0"><data>eee</data></news> must sec "zero" because there isn't weight=3 in input list. , on thanks
xml sorting xslt xslt-2.0
Comments
Post a Comment