[Koha-devel] Random XSLT knowledge

David Cook dcook at prosentient.com.au
Fri Mar 8 03:02:38 CET 2024


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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20240308/56fa939f/attachment.htm>


More information about the Koha-devel mailing list