Re: [xsl] Basics of XSLT

Subject: Re: [xsl] Basics of XSLT
From: himanshu padmanabhi <himanshu.padmanabhi@xxxxxxxxx>
Date: Tue, 10 Mar 2009 15:44:53 +0530
Thank you.Can anyone explain XPath more?

I was advised to use "XML::LibXSLT::xpath_to_string" in the following code.

 my $parser = XML::LibXML->new();
 my $xslt = XML::LibXSLT->new();

 my $source = $parser->parse_file($xmlfile);
 my $style_doc = $parser->parse_file($xslfile);

 my $stylesheet = $xslt->parse_stylesheet($style_doc);

 my $results = $stylesheet->transform($source,
XML::LibXSLT::xpath_to_string(args => "$in{'args'}",value => "$value",
cnt => "1",);

 print $stylesheet->output_string($results);


On Tue, Mar 10, 2009 at 3:25 PM, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
> I'll try to answer this.
>
> On Tue, Mar 10, 2009 at 2:30 PM, himanshu padmanabhi
> <himanshu.padmanabhi@xxxxxxxxx> wrote:
>> 1.Why XSLT is actually used?and what it is exactly?
>
> XSLT is a language, which can transform an XML input (with XSLT 2.0,
> we can take a Text input as well) to various kinds of outputs (like
> XML, HTML and Text).
>
>> 2.I am using XPATH to pass arguments in my perl code.
>>     What is XPATH?and what is its significance?
>
> XPath is a language to address parts of the XML document. In XPath, we
> write expressions, which return a set of nodes (called sequences in
> XPath 2.0). Though XPath can be used standalone, but it is usually
> used in combination with a language like XSLT or XQuery. XSLT and
> XQuery *need* XPath.
>
>>
>> 3. <xmlns:xsl="http://www.w3.org/1999/XSL/Transform";> Why this is
>> required at start of every XSL file?
>
> An XSLT program file is an XML file. By using this namespace in a XSLT
> file, we can distinguish between XSLT language instructions and
> non-XSLT elements/attributes.
>
>
> --
> Regards,
> Mukul Gandhi
>
>



--
Regards,
Himanshu Padmanabhi

Current Thread