Hi David,
Thanks for sharing.
Would you have an example of how you use register_function with Koha functions 
to share?

Marcel

________________________________
Van: Koha-devel <koha-devel-boun...@lists.koha-community.org> namens David Cook 
via Koha-devel <koha-devel@lists.koha-community.org>
Verzonden: vrijdag 8 maart 2024 03:02
Aan: 'Koha Devel' <koha-devel@lists.koha-community.org>
Onderwerp: [Koha-devel] Random XSLT knowledge


Hi all,



I’ve been working on performance issues, and in the process I got looking at 
XSLTs.



I just wanted to share that it’s possible to pass strings to the XSLT’s 
transform() method:



-    return $engine->transform($xmlrecord, $xslfilename ); #file or URL

+    return $engine->transform({

+        xml => $xmlrecord,

+        file => $xslfilename,

+        parameters => {

+            test => "'$test_str'",

+        },

+    }); #file or URL



It’s somewhat limited in that you can only pass strings and I think there’s a 
small limit on the number of parameters you can pass (not sure if it’s 32 or 
255), but I thought it was interesting. It would allow you to pass some data 
that you have at hand on a per-XML record basis without having to mangle the 
XML record (like we do with items and system preferences).



In the end, I didn’t end up using it though. Instead, I use 
XML::LibXSLT->register_function() to provide access to Koha functions from the 
XSLT, and in this case that meets my needs.



Anyway, back to it..



David Cook

Senior Software Engineer

Prosentient Systems

Suite 7.03

6a Glen St

Milsons Point NSW 2061

Australia



Office: 02 9212 0899

Online: 02 8005 0595


_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/

Reply via email to