Hello,
A modifying XSLT Identity Transform pattern is a powerful and elegant technique that uses a general "catch-all" template to copy the entire input XML
structure, combined with more specific templates that override the default behavior to make targeted changes. This approach ensures that everything not
explicitly matched by a custom template remains unchanged.
Is it possible to do the same in BaseX 12 for JSON via XQuery 4.0?
Is it possible to implement the XQuery 4.0 & JSON equivalent of XSLT’s identity template, but with the ability to make small, targeted changes while otherwise copying the input
unchanged:
1) Parse JSON to XQuery’s native JSON model (order‑preserving maps/arrays) using the JSON module’s w3 format (lossless, W3C‑aligned).
2) Walk that value and rebuild it, applying tweaks where needed (rename a key, drop a field, change a value, etc.), while copying everything else.
3) Serialize back to JSON with the same format (and any serialization parameters that are required).
Regards,
Yitzhak Khabinsky