grashoper has asked for the wisdom of the Perl Monks concerning the following question:
my transform (section applying to advertssub adverts { my $str = ""; if ($Session->{'showAds'} && $Session->{'isAuthenticated'}) { my $adverts = xmlFileData("Content", "adverts.xml", "adverts()") +; $adverts .= xmlFileData("Content/Adverts", $Session->{'usrSystem +'}.$Session->{'usrAccount'}.".xml", "adverts()") ? xmlFileData("Conte +nt/Adverts", $Session->{'usrSystem'}.$Session->{'usrAccount'}.".xml", + "adverts()") : xmlFileData("Content/Adverts", $Session->{'usrSystem' +}.".xml", "adverts()"); $adverts =~ s/<\/adverts>\s*?<adverts>//g; my $i = 0; while ($adverts =~ s/id=""/id="$i"/) { $i++; } if ($i) { my $currentAdvert = $min % $i; if ($adverts =~ /(<advert id="$currentAdvert".*?\/>)/) { $str = "<adverts>$1</adverts>"; } } } return $str;
my problem is once the transform runs my document is offset to the right and looks really screwed up. I am using a heredoc, and this was all done by someone else, it needs a rewrite, but so far maintenance of it is taking all my time.<xsl:template match="adverts"> <div id="adverts"> <table width="{/document/@docWidth}" border="0" cellpadding="0" +cellspacing="0" align="left"> <tr> <td style="text-align:left;" height="60" width="468"> <img src="images/revbnr_left.jpg"/> <xsl:if test="count(advert) > 0"> <a href="{/document/@this}?{/document/@queryString}&x +URL={advert/@url}"><img src="{advert/@src}" height="{advert/@height}" + width="{advert/@width}" alt="{advert/@alt}"/></a> </xsl:if> </td> <td style="text-align:right;vertical-align:middle;" height=" +1"> <xsl:if test="count(/document/config/includeLiveHelp) &g +t; 0 and /document/config/includeLiveHelp/@startTime < /document/@ +time and /document/config/includeLiveHelp/@endTime > /document/@ti +me"> <a href="http://server.iad.liveperson.net/hc/15823 +250/?cmd=file&file=visitorWantsToChat&site=15823250&byhre +f=1&VISITORVAR!Username={/document/config/includeLiveHelp/@userna +me}&VISITORVAR!Account={/document/config/includeLiveHelp/@account +}&VISITORVAR!System={/document/config/includeLiveHelp/@system}&am +p;VISITORVAR!Password={/document/config/includeLiveHelp/@password}" target="chat15823250" + onClick="javascript:window.open('http://server. +iad.liveperson.net/hc/15823250/?cmd=file&file=visitorWantsToChat& +amp;site=15823250&VISITORVAR!Username={/document/config/includeLi +veHelp/@username}&VISITORVAR!Account={/document/config/includeLiv +eHelp/@account}&VISITORVAR!System={/document/config/includeLiveHe +lp/@system}&VISITORVAR!Password={/document/config/includeLiveHelp +/@password}&referrer='+escape(document.location),'chat15823250',' +width=472,height=320,location=no,top=0,left=0,resizable=yes,status=no +');return false;"> <img src="http://server.iad.liveperson.net/hc/15 +823250/?cmd=repstate&site=15823250&ver=1&category=en;woma +n;7" name="hcIcon" width="165" height="60" border="0"/> </a> </xsl:if>
|
|---|