xsl-list
[Top] [All Lists]

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

2019-10-17 12:14:35
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(_at_)pitt(_dot_)edu <ebb8(_at_)pitt(_dot_)edu>
Development site: http://newtfire.org


On Thu, Oct 17, 2019 at 12:51 PM Adam Retter 
adam(_dot_)retter(_at_)googlemail(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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(_at_)mitre(_dot_)org
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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/>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>