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); }
In reply to Please help with the issue in XML::LibXSLT module by denzil_cactus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |