learn2earn has asked for the wisdom of the Perl Monks concerning the following question:
and finally an example xml file.sub mTutorials { if ( $Request->ServerVariables("SERVER_NAME")->item() =~ /tempohelp/ +i ) { $str.=mLeftIndex(); my $xml = xmlFileData("Content", "tempotutorials.xml", "mTutorials() +"); if ($Request->item("DocID")->item()) { my $id = $Request->item("DocID")->item(); $xml =~ /(<tut id=\"$id\".*?\/>)/s; $str .= $1; } else { $xml =~ /(<tempo.*?<\/tempo>)/s; $str .= shadowBox("Tempo Tutorials", "<tutorials>".$1."</tutoria +ls>", ($g_docWidth/5*4-(2*$g_docSpace))); $xml =~ /(<general.*?<\/general>)/s; $str .= shadowBox("General PC Tutorials", "<tutorials>".$1."</tu +torials>", ($g_docWidth/5*4-(2*$g_docSpace))); } #$str.=mLeftIndex(); return $str; } else { $str.=mLeftIndex(); my $xml=xmlFileData("Content", "tutorials.xml", "mTutorials()"); if ($Request->item("DocID")->item()) { #my $id = $Request->item("DocID")->item(); $xml =~ /(<tut id=\"$id\".*?\/>)/s; $str .= $1; } else { $xml =~ /(<mlxchange.*?<\/mlxchange>)/s; $xml .=~/(<description.*?<\/description>)/s; $str .= shadowBox("MLXchange Tutorials & Demos", "<tutorials +>".$1."</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); $xml =~ /(<general.*?<\/general>)/s; $str .= shadowBox("General PC Tutorials", "<tutorials>".$1."</tu +torials>", ($g_docWidth/5*4-(2*$g_docSpace))); } return $str; } }
as for transforms there are a total of 11 xsl files so I am not sure if posting them would be all that helpful, since it should be do-able using code, the site is using a here-doc. say I add the description tags above to my xml file, I am not sure how to get the contents of the description tag and the contents of the mlxchange tags to both display, there is a function called shadowbox which takes as its argument the title, the <tag>$whatever</tag> and docheight/docspace as arguments, what I really want is to stuff some other data in that box as $2 but I am not sure how to assign it properly, as I stated prior I am terrible at understanding regex. I guess I could assign a variable to the description regex as a placeholder then maybe concatenate the 2 values so that I get what I am after? <link> followed by description.. its hard to explain how this is setup, its a mess but unfortunately I am stuck with it. <code> $xml =~/(<description.*?<\/description>)/s;tutorials> <mlxchange> <tut id="15" treatment="external" src="http://www.mlxhelp.com/ +content/tutorials/mlx40/ActiveX_demo_mlx.htm" width="850" height="650 +" title="How to Install ActiveX Controls" /><description>This is a gr +eat tutorial watch it></description> </mlxchange> </tutorials>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to add descriptions?
by marto (Cardinal) on Mar 04, 2010 at 11:01 UTC | |
|
Re: how to add descriptions?
by Anonymous Monk on Mar 03, 2010 at 16:51 UTC | |
by learn2earn (Acolyte) on Mar 03, 2010 at 18:20 UTC | |
by Anonymous Monk on Mar 04, 2010 at 04:15 UTC | |
|
Re: how to add descriptions?
by Jenda (Abbot) on Mar 04, 2010 at 19:32 UTC |