X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FUtils.pm;h=371a7dedeb294f6301dd9be634aa063f75a01ca7;hp=9f672fe85fa3d2cb8f1c2e06bd9ba73e32df3d31;hb=d9d44e8220067d39978efcebcc2fd1664da9b701;hpb=1cce91772405dcb67ae975e632bf98b0c0541253 diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index 9f672fe..371a7de 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,4 @@ -# $Id: Utils.pm,v 1.17 2006-11-29 18:15:10 mike Exp $ +# $Id: Utils.pm,v 1.20 2006-12-11 13:58:17 sondberg Exp $ package ZOOM::IRSpy::Utils; @@ -36,7 +36,13 @@ sub isodate { # Template::Plugin both roll their own. So I will do likewise. D'oh! # sub xml_encode { - my($text, $fallback) = @_; + my($text, $fallback, $opts) = @_; + if (!defined $opts && ref $fallback) { + # The second and third arguments are both optional + $opts = $fallback; + $fallback = undef; + } + $opts = {} if !defined $opts; $text = $fallback if !defined $text; use Carp; @@ -46,8 +52,11 @@ sub xml_encode { $text =~ s/&/&/g; $text =~ s//>/g; - $text =~ s/['']/'/g; + # Internet Explorer can't display ' (!) so don't create it + #$text =~ s/['']/'/g; $text =~ s/[""]/"/g; + $text =~ s/ / /g if $opts->{nbsp}; + return $text; } @@ -276,7 +285,11 @@ sub inheritance_tree { } -#print "Loaded ZOOM::IRSpy::Utils.pm"; +# This function is made available in xslt using the register_function call +sub xslt_strcmp { + my ($arg1, $arg2) = @_; + return ($arg1->to_literal()) cmp ($arg2->to_literal()); +} 1;