xsl-list
[Top] [All Lists]

[xsl] passing parameters to XSL,what if no value in some cases

2009-03-06 04:28:32
First time,code will go to 'else' part,it again returns to this form
and 'if' part executes.

<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);
        if($in{'flag'} eq "2") {
            my $results = $stylesheet->transform($source,
XML::LibXSLT::xpath_to_string(args => "$in{'args'}",val => "1",new =>
"$in{'new'}"));
            print $stylesheet->output_string($results);
        }else{
            my $results = $stylesheet->transform($source,
XML::LibXSLT::xpath_to_string(args => "",val => "3",new =>
"$in{'new'}"));
            print $stylesheet->output_string($results);
        }
</CODE>

1.In my 'else' above,I don't want to pass 'args'(can I do it?),

2.How can I check in my xsl file whether it is passed or not probably
using some 'if' statement or something like this?
<CODE>
    <xsl:choose>
    <xsl:when test="args_is_given">
         <some code>
    </xsl:when>
    </xsl:choose>
</CODE>


-----------------------------
Regards,
Himanshu Padmanabhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--