Re: [xsl] Does XQuery allow you to modify the XML? (remove elements, modify element values)

Subject: Re: [xsl] Does XQuery allow you to modify the XML? (remove elements, modify element values)
From: "Elisa Beshero-Bondar ebbondar@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Oct 2019 17:14:31 -0000
Ah, that's right--it's called type-switching in XQuery, and it's something
I experimented with a year or two ago to see if I could really do
everything in XQuery that I do in XSLT. I love both, but I tend to use
XQuery for pulling and visualizing data from complex documents, and if I
need to represent a complete, complex file with just a few spot revisions,
XSLT really seems easier. It may be that I didn't find the right
documentation, though.

For type-switching, there's this:
https://en.wikibooks.org/wiki/XQuery/Typeswitch_Transformations

Admittedly, I know XSLT identity transformations better, and it's how I
teach my students to *start* their first XSLT because it's so very easy,
especially in XSLT 3.0: https://dh.newtfire.org/XSLTExercise1.html
I mean, seriously, what could be easier than xsl:mode
on-no-match="shallow-copy"/  , and then writing a couple of dedicated
template rules to change exactly what you need?

Cheers,
Elisa
-- 
Elisa Beshero-Bondar, PhD
Director, Center for the Digital Text | Associate Professor of English
University of Pittsburgh at Greensburg | Humanities Division
150 Finoli Drive
Greensburg, PA  15601  USA
E-mail: ebb8@xxxxxxxx <ebb8@xxxxxxxx>
Development site: http://newtfire.org


On Thu, Oct 17, 2019 at 12:51 PM Adam Retter adam.retter@xxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Yes, you can either write a type-switch transformation in XQuery to
> create a new document by filtering the content of your original
> document, or you could use XQuery Update if your processor supports
> it.
>
> For typeswitches, this might be useful -
> https://en.wikibooks.org/wiki/XQuery/Typeswitch_Transformations
>
> On Thu, 17 Oct 2019 at 16:55, Costello, Roger L. costello@xxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hi Folks,
> >
> > It's been a long time since I've looked at XQuery.
> >
> > I need to identify certain elements in XHTML documents and then either
> remove the elements or modify their values. Can XQuery do this? Are there
> free XQuery tools?
> >
> > XHTML --> XQuery --> XHTML' (a modified version of the input XHTML
> document)
> >
> > /Roger
> >
>
>
>
> --
> Adam Retter
>
> skype: adam.retter
> tweet: adamretter
> http://www.adamretter.org.uk
> 
>


<http://newtfire.org/>

Current Thread