You mention that you have a series of transformations, which I take to mean
a pipeline (i.e. the transformations are chained together, where the output
of one transformation becomes the input of the next). Since you are
obviously interested not just in getting this particular job done, but also
in acquiring new XML skills as you go, you may be interested to take a look
at the XML Pipeline language "XProc". <https://www.w3.org/TR/xproc/>
Like XSLT, it makes much use of XPath, and uses an XML syntax. To someone
who knows XSLT, it will feel very familiar. Instead of XSLT's
pattern-matching, "find-and-replace" paradigm, XProc is a "data-flow"
language in which XML documents flow through a series of steps, similarly
to the way that documents are processed and "piped" between steps such as
"sed" and "grep" in shell scripts.
Executing an XSLT or an XQuery is a primitive operation (a "step") in the
language. It includes constructs for loops and switches and filters,
reading and writing files and making http requests, schema validation, and
so on. And you can define a pipeline as a series of steps, and then call
that pipeline as a step (like calling a method in an object oriented
language, or a template in XSLT).
It also include some simple steps such as "delete" (<
https://www.w3.org/TR/xproc/#c.delete>) which in the case of your example
would look like:
<!-- delete records like these:
<marc:datafield tag="710" ind1="2" ind2=" ">
<marc:subfield code="a">Faux College</marc:subfield>
<marc:subfield code="b">Special Collections</marc:subfield>
I think XProc is a great language for munging XML-based data; I've used it
a lot, using the XMLCalabash XProc interpreter <http://xmlcalabash.com/>. I
often wonder why more systems librarians haven't got into it; it deserves
to be more widely known and used.
On 12 January 2017 at 06:06, Julie Swierczek <[log in to unmask]>
> Thanks. I started with Marc Edit and you are correct that it is very easy
> to use. The reason I wanted to do this in XSLT is that is part of a series
> of other transformations I need to do, and I figured I might as well learn
> how to do it now. (I am picking up a lot of XSLT skills while messing with
> these files, and I figure I might as well carry on with doing so.)
> But thank you very much for the suggestion - hopefully someone else will
> be able to use it!