Hey there, Thanks for the thought, i dont think it is scoping but, in the interest of 'full disclosure' here the code. its a Handler for Apache/mod_perl, however i dont think that this is a problem with that, more LibXML. Anyway, here is the code:
sub start { my ($r,$params) = @_; # open the database handle and get the data from the table my $db=LMS2::Library->open_lms(); my $cat_sth = $db->prepare("SELECT * FROM CompCat ORDER BY descrip +tion "); $cat_sth->execute; my $parser = XML::LibXML->new(); my $XMLPath = $r->server_root_relative("LMS2/XML"); my $location = $r->location(); my $tree=$parser->parse_file($XMLPath."/Competancy.xml"); my $first; # prepare list of categories my @list2 = $tree->findnodes('//select[@id="categoryID"]') || warn "couldnt find any nodes for select & name of cate +goryID"; while (my $row=$cat_sth->fetchrow_hashref ) { my $node = XML::LibXML::Element->new('option'); $node->setAttribute('value',$row->{id}); if ($row->{id} == $params->{categoryID}) { $node->setAttribute('selected','selected'); } my $text = XML::LibXML::Text->new($row->{description}); $node->appendChild($text); $list2[0]->push($node); } my $parser2 = XML::LibXSLT->new(); my $ss=$parser2->parse_stylesheet_file($XMLPath."/HTMLConvert.xsl" +); my $res=$ss->transform($tree); my $htmlpage = $ss->output_string($res); $htmlpage =~ s/__HOST__/$hn{Host}/gim; $r->print($htmlpage); }

In reply to Re: Re: LibXML 'Fun' by stefzody
in thread LibXML 'Fun' by stefzody

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.