I am trying to input a switch so that I can add content to a page on my dbdriven website, however I can't seem to get it right today here is the code, this is using a heredoc to output and using an xslt

sub mLeftIndex { my $str = ""; #Sets content to blank my $logoutLink = "<link tab=\"\" view=\"Logout\" title=\"Logout\"/ +>"; #Generates Logout link# SWITCH: { if (($Request->item("Tab")->item() eq "Support") and ($selected +="CTS")) { # Inserts leftIndex tag for document # #$xml = qq^<leftIndex>^; #sets menuitem for left hand side # $xml.=qq^ <link tab="Support" view="ClassOutlines" title="Course Outlines +"> <description>Outlines for CTMLS Courses</description> <header>0</header> </link>; ^; #closes menuitem and closing leftIndex tag here # $xml=qq^ </leftIndex> ^; #patternmatch stuff for here document.. if (!$Request->item("View")->item() && $xml =~ /(.*?)<link tab +=\"Support\" view=\"Search\" .*?<\/link>(.*)/s) { $xml = $1.$2; } $xml =~ s/(<\/leftIndex>)/$logoutLink$1/s; $str .= $xml; } # other content for support tab # if ($Request->item("Tab")->item() eq "Support") { my $xml =qq^ <leftIndex> ^; $xml .= qq^ <link tab="Support" view="Search" title="Search"> <description>Search our Help Articles</description> <header>0</header> </link> <link tab="Support" view="HowTo" title="How To Use MLXchange"> <description>Walkthroughs for common tasks using MLXchange</descri +ption> <header>0</header> </link> <link tab="Support" view="Tutorials" title="MLXchange Tutorials"> <description>Tutorials and Demos showing you how to use MLXchange< +/description> <header>0</header> </link>^ if ( $Request->ServerVariables("SERVER_NAME")->item() =~ /m +lxhelp/i ); $xml .= qq^ <link tab="Support" view="PCMaint" title="PC Maintenance"> <description>Some Helpful tips for maintaining your PC</descriptio +n> <header>0</header> </link> ^; $xml .=qq^ <link tab="Support" view="Tempotutorials" title="Tempo Tutorials"> <description>Tempo Tutorials</description> <header>0</header> </link> <link tab="Support" view="TManuals" title="Tempo UserGuide"> <description>Tempo UserGuide</description> <header>0</header> </link>^ if ($Request->ServerVariables("SERVER_NAME")->item()=~/tempoh +elp/i); $xml .= qq^ <link tab="Support" view="Manuals" title="MLXchange Manuals"> <description>Documentation of MLXchange Software</description> <header>0</header> </link> <link tab="Support" view="FAQ" title="Frequently Asked Questions"> <description>Answers to the Most Common Questions</description> <header>0</header> </link> ^ if ( $Request->ServerVariables("SERVER_NAME")->item() =~ /mlxhelp/i +); $xml .= qq^ </leftIndex> ^; if (!$Request->item("View")->item() && $xml =~ /(.*?)<link tab +=\"Support\" view=\"Search\" .*?<\/link>(.*)/s) { $xml = $1.$2; } $xml =~ s/(<\/leftIndex>)/$logoutLink$1/s; $str .= $xml; last SWITCH; }

I get following error when I try to run this. Error Code: -1072896659 Reason: End tag 'leftIndex' does not match the start tag 'body'. Line: 2820

In reply to outputting xml by grashoper

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.