forked from pool/perl-XML-LibXSLT
This commit is contained in:
committed by
Git OBS Bridge
parent
17e94c10b4
commit
992a58c270
66
perl-XML-LibXSLT-wrongtest.diff
Normal file
66
perl-XML-LibXSLT-wrongtest.diff
Normal file
@@ -0,0 +1,66 @@
|
||||
--- t/10functions.t
|
||||
+++ t/10functions.t
|
||||
@@ -1,5 +1,5 @@
|
||||
use Test;
|
||||
-BEGIN { plan tests => 33 }
|
||||
+BEGIN { plan tests => 31 }
|
||||
use XML::LibXSLT;
|
||||
|
||||
{
|
||||
@@ -86,56 +86,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
-{
|
||||
- # testcase by Elizabeth Mattijsen
|
||||
- my $parser = XML::LibXML->new;
|
||||
- my $xsltproc = XML::LibXSLT->new;
|
||||
-
|
||||
- my $xml = $parser->parse_string( <<'XML' );
|
||||
-<html><head/></html>
|
||||
-XML
|
||||
- my $xslt = $parser->parse_string( <<'XSLT' );
|
||||
-<xsl:stylesheet
|
||||
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
- xmlns:foo="http://foo"
|
||||
- version="1.0">
|
||||
-<xsl:template match="/html">
|
||||
- <html>
|
||||
- <xsl:apply-templates/>
|
||||
- </html>
|
||||
-</xsl:template>
|
||||
-<xsl:template match="/html/head">
|
||||
- <head>
|
||||
- <xsl:copy-of select="foo:custom()/foo"/>
|
||||
- <xsl:apply-templates/>
|
||||
- </head>
|
||||
-</xsl:template>
|
||||
-</xsl:stylesheet>
|
||||
-XSLT
|
||||
-
|
||||
- my $aux = <<'XML';
|
||||
-<bar>
|
||||
- <y><foo>1st</foo></y>
|
||||
- <y><foo>2nd</foo></y>
|
||||
-</bar>
|
||||
-XML
|
||||
- {
|
||||
- XML::LibXSLT->register_function(
|
||||
- ('http://foo', 'custom') => sub { $parser->parse_string( $aux )->findnodes('//y') }
|
||||
- );
|
||||
- my $stylesheet = $xsltproc->parse_stylesheet($xslt);
|
||||
- my $result = $stylesheet->transform($xml);
|
||||
- ok ($result->serialize,qq(<?xml version="1.0"?>\n<html xmlns:foo="http://foo"><head><foo>1st</foo><foo>2nd</foo></head></html>\n));
|
||||
- }
|
||||
- {
|
||||
- XML::LibXSLT->register_function(
|
||||
- ('http://foo', 'custom') => sub { $parser->parse_string( $aux )->findnodes('//y')->[0]; });
|
||||
- my $stylesheet = $xsltproc->parse_stylesheet($xslt);
|
||||
- my $result = $stylesheet->transform($xml);
|
||||
- ok ($result->serialize,qq(<?xml version="1.0"?>\n<html xmlns:foo="http://foo"><head><foo>1st</foo></head></html>\n));
|
||||
- }
|
||||
-}
|
||||
-
|
||||
{
|
||||
my $parser = XML::LibXML->new;
|
||||
my $xsltproc = XML::LibXSLT->new;
|
Reference in New Issue
Block a user