Talkback for article: 156, July2000
An Introduction to Perl's XML::XSLT module
From: Laurent <BillonLa(at)Voila.fr>
[ date: 2001-11-28 ]
Hi,
I use the XML : XSLT module, and there is always the same problem.
-Here is the file XML
<?xml version="1.0" ?>
<getInfo>
<infos>
<info descr="Nom domaine">xxxx.xxxxx.xx</info>
<info descr="Nom machine">xxxxxxxx</info>
<info descr="Adresse Ip">xxx.xxx.xxx.xxx</info>
<info descr="Utilisateur connecté">xxxxxx</info>
<info descr="Imprimante par défaut">HP LaserJet 4P</info>
<info descr="Port par défaut">LPT1:</info>
<info descr="Port fabriqué avec">Master National léger 3.1</info>
<info descr="Plate forme logiciel">Plate-forme Logicielle Légère 1.3</info>
<info descr="Modifications"></info>
<info descr="VersionIns"></info>
</infos>
<Defaut>
<info methode="modifications_">"MODIF" n'est pas dans la base de registre</info>
<info methode="version_ins">"Version" n'est pas dans la base de registre</info>
</Defaut>
</getInfo>
- Here is the file XSL
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<TABLE border="1" align="right">
<TR><TH colspan="3">DEFAUTS</TH></TR>
<TR>
<TH>Nom</TH>
<TH>Description</TH>
</TR>
<xsl:for-each select="getInfo/Defaut/info">
<TR>
<TD><xsl:value-of select="@methode"/></TD>
<TD><xsl:value-of select="."/></TD>
</TR>
</xsl:for-each>
</TABLE>
<TABLE border="1" align="left">
<TR>
<TR><TH colspan="3">DONNEES</TH></TR>
<TH>Nom</TH>
<TH>Description</TH>
</TR>
<xsl:for-each select="getInfo/infos/info">
<TR>
<TD><xsl:value-of select="@descr"/></TD>
<TD><xsl:value-of select="."/></TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>
- The code Perl
use strict;
use XML::XSLT;
my $xslfile="C:/Config.xsl";
my $xmlfile="C:/Admin.xml";
my $parser1 = XML::XSLT->new($xslfile, debug=>1, warnings => 1);
$parser1->transform($xmlfile);
print $parser1->toString;
$parser1->dispose();
-Error message
creating parser object:
opening xsl...
opening document
Opening URL
Error while parsing:
no element found at line 1, column 0, byte -1 at C:/Intranet/Perl/site/lib/XML/Parser.pm line 168
C:/Config.xsl at C:/Intranet/Perl/site/lib/XML/XSLT.pm line 850.
Thank for your answer.
From: arnaud <illicoman(at)hotmail.com>
[ date: 2003-04-11 ]
bravo !!
c'est génial pour gérer les menu avec des images c'est rapide c'est impréssionnant !
merci merci merci
2 talkbacks in Francais
Other talkbacks: English
Due to the increased amount of web spam we have deciced to
removed the talkback posting possibility. You can read old talkbacks
but you can no longer post new ones.
Please contact webmaster(at)linuxfocus.org if you have any questions with regards to this talkback
lftalkback version 3.10