Advertisement
weeez

xquery solver

Jun 8th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1.  
  2. for $it in $input
  3. return
  4. <Logic>
  5. {
  6. for $x in $it/Shipment
  7. return
  8. <Shipment>
  9. <ShipmentHeader>
  10. {
  11. let $head := $x/ShipmentHeader
  12. return data($head)
  13. }
  14. </ShipmentHeader>
  15. <Data>
  16. {
  17. let $date := $x/Date
  18. let $day := substring(data($date),1,2)
  19. let $month := substring(data($date),4,2)
  20. let $year := substring(data($date),7,4)
  21.  
  22. let $subString := concat($year, $month, $day)
  23. return $subString
  24. }
  25. </Data>
  26. <ShipmentNumber>
  27. {
  28. let $num := $x/ShipmentNumber
  29. return data($num)
  30. }
  31. </ShipmentNumber>
  32. </Shipment>
  33.  
  34. }
  35. <Shipper>
  36. {
  37. let $shipper := $it/Shipper/*
  38. return $shipper
  39. }
  40. </Shipper>
  41. <Position>
  42. <Amount>
  43. {
  44. let $head := ($it/Position/Amount)
  45. return sum(data($head))
  46. }
  47. </Amount>
  48. <Weight>
  49. {
  50. let $head := ($it/Position/Weight)
  51. return sum(data($head))
  52. }
  53. </Weight>
  54. <Length>
  55. {
  56. let $head := ($it/Position/Length)
  57. return sum(data($head))
  58. }
  59. </Length>
  60. <Width>
  61. {
  62. let $head := ($it/Position/Width)
  63. return sum(data($head))
  64. }
  65. </Width>
  66. <Height>
  67. {
  68. let $head := ($it/Position/Height)
  69. return sum(data($head))
  70. }
  71. </Height>
  72. </Position>
  73. </Logic>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement