xsl-list
[Top] [All Lists]

[xsl] Re: [xquery-talk] fn:transform running with default call-template invocation - no result-documents created

2021-02-11 16:23:49
Basically, XSLT made some compromises on functional purity with 
xsl:result-document, which XQuery wasn't prepared to contemplate. The XQuery 
designers, coming from the database query language tradition, have always put 
optimisability at the top of their agenda, and that meant that fn:transform() 
wasn't going to be acceptable if it could have side effects.

Michael Kay
Saxonica


On 11 Feb 2021, at 20:12, Ihe Onwuka <ihe(_dot_)onwuka(_at_)gmail(_dot_)com> 
wrote:

Yes I see this is what it was designed to do....I could also serialize this 
out by specifying a post-process function. 
Too much extra palava - it was only meant to be an XQuery wrapper around an 
already working transformation. 


On Thu, Feb 11, 2021 at 2:49 PM Liam R. E. Quin 
<liam(_at_)fromoldbooks(_dot_)org <mailto:liam(_at_)fromoldbooks(_dot_)org>> 
wrote:
On Thu, 2021-02-11 at 09:27 -0500, Ihe Onwuka wrote:

However if I invoke it from XQuery with fn:transform like so

xquery version "3.1";
fn:transform(map { 'stylesheet-node' :  doc('test.xsl')})?output

none of the result-documents are created.

You need to go on my XSLT course :-)

What happens is the content that would have been written out via
result-document ends up in the result map, with the keys being the URIs
to which they would have been written.

So, save the result of fn:transform() and use map:keys() or map:each()
to find them and use e.g. file:write() or fn:put() or database:store-
somewhere() as appropriate.

Liam


-- 
Liam Quin, https://www.delightfulcomputing.com/ 
<https://www.delightfulcomputing.com/>
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org 
<http://www.fromoldbooks.org/>

_______________________________________________
talk(_at_)x-query(_dot_)com
http://x-query.com/mailman/listinfo/talk
--~----------------------------------------------------------------
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>