CPAN::Forum
XML-LibXML - runtime error: element apply-templates
| Posted on Fri Feb 10 21:20:57 2006 by clew |
| runtime error: element apply-templates |
|
I am trying to convert xml file using XML::LibXSLT,while doing like
the below method its working fine
my $source = $parser->parse_file('select.xml');
my $style_doc = $parser->parse_file('xsql.xsl');
y $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
my $sur =$stylesheet->output_string($results);
print $sur
# I am getting the output for the above code
But when i am trying to read the data from the xml file using
getElementsByTagName like this and pass that tree structure to transform its
giving a error
my $source = $parser->parse_file('select.xml');
my @resultlist = $source->getElementsByTagName($tag);
my $style_doc = $parser->parse_file('xsql.xsl');
y $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform(@resultlist);
my $sur =$stylesheet->output_string($results);
print $sur;
print $sur; # This throws a error message
runtime error: file xsql.xsl element apply-templates
xsl:apply-templates : can't find doc
Here in the above case it was failing during the apply-templates.
I am using the same xsl while in both cases, I don't know what is wrong
here.
|
| Write a response |
(9)
]