denzil_cactus has asked for the wisdom of the Perl Monks concerning the following question:
Output After XSLT Conversion:<?xml version="1.0" encoding="utf-8"?> <File xmlns ="http://www.w3.org/2001/XMLSchema"> <DataDescrip> <ID>C01362023</ID> <Reference>702154</Reference> </DataDescrip> </File>
<?xml version="1.0"?> C01362023 702154 <b>.xsl file used for Conversion</b> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" versi +on="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="File"> <Data xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsl:for-each select="DataDescrip"> <xsl:element name="Details"> <xsl:element name="ReferenceID"><xsl:value-of select="Reference"/></xs +l:element> </xsl:element> </xsl:for-each> </Data> </xsl:template> </xsl:stylesheet>
foreach my $file (@files) { eval('use XML::LibXML'); eval('use XML::LibXSLT'); my $oXslt = XML::LibXSLT->new(); my $oSource = XML::LibXML->load_xml(location => $file); my $oStylesheetDoc = XML::LibXML->load_xml(location => $cPath, no_cdat +a=>1); my $hXSLTDoc = $oXslt->parse_stylesheet($oStylesheetDoc); my $hOutput = $hXSLTDoc->transform($oSource); my $cFilecontent = $hXSLTDoc->output_as_bytes($hOutput); my $cConvertedFile = $file."_Converted.XML"; open(FH,">$cConvertedFile") or die "cannot open $cConvertedFile : $!\n +"; print FH $cFilecontent; close(FH); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Please help with the issue in XML::LibXSLT module
by haukex (Archbishop) on Apr 04, 2017 at 14:02 UTC | |
|
Re: Please help with the issue in XML::LibXSLT module
by poj (Abbot) on Apr 04, 2017 at 13:55 UTC | |
|
Re: Would like to delete the node
by 1nickt (Canon) on Apr 04, 2017 at 11:46 UTC | |
by james28909 (Deacon) on Apr 04, 2017 at 11:52 UTC | |
|
Re: Would like to delete the node
by marto (Cardinal) on Apr 04, 2017 at 11:53 UTC | |
|
Re: Would like to delete the node
by haukex (Archbishop) on Apr 04, 2017 at 11:46 UTC |