+=head2 XSLTParse4Display
+
+Returns xml for biblionumber and requested XSLT transformation.
+Returns undef if the transform fails.
+
+Used in OPAC results and detail, intranet results and detail, list display.
+(Depending on the settings of your XSLT preferences.)
+
+The helper function _get_best_default_xslt_filename is used in a unit test.
+
+=cut
+
+sub _get_best_default_xslt_filename {
+ my ($htdocs, $theme, $lang, $base_xslfile) = @_;
+
+ my @candidates = (
+ "$htdocs/$theme/$lang/xslt/${base_xslfile}", # exact match
+ "$htdocs/$theme/en/xslt/${base_xslfile}", # if not, preferred theme in English
+ "$htdocs/prog/$lang/xslt/${base_xslfile}", # if not, 'prog' theme in preferred language
+ "$htdocs/prog/en/xslt/${base_xslfile}", # otherwise, prog theme in English; should always
+ # exist
+ );
+ my $xslfilename;
+ foreach my $filename (@candidates) {
+ $xslfilename = $filename;
+ if (-f $filename) {
+ last; # we have a winner!
+ }
+ }
+ return $xslfilename;
+}