xmltv/grab/is tv_grab_is,1.26,1.27

Geoff <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/is
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19197

Modified Files:
	tv_grab_is 
Log Message:
- add category 13
- change category lookup to avoid strange xslt error

Index: tv_grab_is
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/is/tv_grab_is,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** tv_grab_is	22 Jun 2011 05:56:34 -0000	1.26
--- tv_grab_is	3 Feb 2014 14:24:19 -0000	1.27
***************
*** 390,394 ****
      my $xslt = XML::LibXSLT->new(); die unless defined $xslt;
      my $stylesheet = $xslt->parse_stylesheet($parser->parse_string($xsl_transform));
!     my $results = $stylesheet->transform($parser->parse_string($xml));
  
      # Step 2: Loop through all programmes and all their children.
--- 390,402 ----
      my $xslt = XML::LibXSLT->new(); die unless defined $xslt;
      my $stylesheet = $xslt->parse_stylesheet($parser->parse_string($xsl_transform));
! 	
! 	# suppress warning message caused by using Perl var rather than a physical document()
! 	my $results;
! 	{
! 		local $SIG{__WARN__} = sub {
! 			warn @_ unless (defined $_[0] && $_[0] =~ /^I\/O warning : failed to load external entity "unknown-/);
! 		};
! 		$results = $stylesheet->transform($parser->parse_string($xml));
! 	}
  
      # Step 2: Loop through all programmes and all their children.
***************
*** 442,448 ****
                  } elsif ($node->nodeName eq 'category') {
                      # FIXME where does the empty category element come from?
!                     if (!$node->hasChildNodes()) {
!                         $programme->removeChild($node);
!                     }
                  }
              }
--- 450,466 ----
                  } elsif ($node->nodeName eq 'category') {
                      # FIXME where does the empty category element come from?
! 					# [bilbo] sometimes (for no determinable reason) the document lookup is failing - maybe because it's 
! 					#	a Perl var and not a real doc, for some reason...? It fails to load the document() (clue = no "I/O warning" in this case)
! 					#	Run it again and it's fine. Or not!
!                     #if (!$node->hasChildNodes()) {
!                     #    $programme->removeChild($node);
!                     #}
! 					# That's just too flaky so let's go "old school" for now (otherwise nightly validator fails)
! 					#	print STDERR "was: ".$node."\n";
! 					my %categories = ( '1'=>'children', '2'=>'series', '3'=>'news', '4'=>'educational', '5'=>'sports', '6'=>'misc', '7'=>'movie', '8'=>'culture', '9'=>'music', '13'=>'news magazine' );
! 					my $category = $categories{$node->firstChild->data};
! 					$node->removeChildNodes();
! 					$node->appendText($category);
! 					#	print STDERR "now: ".$node."\n";
                  }
              }
***************
*** 473,476 ****
--- 491,495 ----
            <entry key="8">culture</entry>
            <entry key="9">music</entry>
+           <entry key="13">news magazine</entry>
          </data:category>
          
***************
*** 509,516 ****
  
          <!-- Two matches for <category>. With funky lookup as explained at http://www.ibm.com/developerworks/library/x-xsltip.html#h2 -->
!         <xsl:template match="category[\@value &gt;= 1 and \@value &lt;= 9]">
              <category>
                  <xsl:variable name="category_value"><xsl:value-of select="\@value" /></xsl:variable>
!                 <xsl:value-of select="document('')/*/data:category/entry[\@key = \$category_value]"/>
               </category>
          </xsl:template>
--- 528,536 ----
  
          <!-- Two matches for <category>. With funky lookup as explained at http://www.ibm.com/developerworks/library/x-xsltip.html#h2 -->
!         <xsl:template match="category[\@value &gt;= 1 and \@value &lt;= 9 or \@value = 13]">
              <category>
                  <xsl:variable name="category_value"><xsl:value-of select="\@value" /></xsl:variable>
!                 <!-- ([bilbo] too flaky - see note above) xsl:value-of select="document('')/*/data:category/entry[\@key = \$category_value]"/-->
!                 <xsl:value-of select="\$category_value"/>
               </category>
          </xsl:template>


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.