XQuery Working Group - February 9, 2018
✓ Published0🌍 Public
CCliffordAnderson
Last edited Feb 10, 2018
Created on Feb 9, 2018
This example demonstrates two XQuery approaches for transforming CSV contact data into XML records, highlighting the difference between excluding a field by name and by structural exception. The first script, `data-munging-with-except.xqy`, uses the arrow operator and `csv:parse` from the XQuery standard library to parse the CSV, then constructs new XML records with `/record/(* except _)` to drop the underscore field. The second script, `data-munging.xqy`, achieves the same result using `$record/*[not(name()='_')]` and additionally persists each record to a database via `db:replace`. Both iterate through parsed records with a `for` loop and assign filenames through the `@name` attribute.
AI-generated description