Manipulate XML Text Data Using XQuery String Functions by Adam Steffanick.
Adam’s notes from the Vanderbilt University XQuery Working Group:
We evaluated and manipulated text data (i.e., strings) within Extensible Markup Language (XML) using string functions in XQuery, an XML query language, and BaseX, an XML database engine and XQuery processor. This tutorial covers the basics of how to use XQuery string functions and manipulate text data with BaseX.
We used a limited dataset of English words as text data to evaluate and manipulate, and I’ve created a GitHub gist of XML input and XQuery code for use with this tutorial.
…
A quick run-through of basic XQuery string functions that takes you up to writing your own XQuery function.
While we wait for more reports from the Vanderbilt University XQuery Working Group, have you considered using XQuery to impose different views on a single text document?
For example, some Bible translations follow the “traditional” chapter and verse divisions (a very late addition), while others use paragraph level organization and largely ignore the tradition verses.
Creating a view of a single source text as either one or both should not involve permanent changes to a source file in XML. Or at least not the original source file.
If for processing purposes there was a need for a static file rendering one way or the other, that’s doable but should be separate from the original XML file.