home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / asp / xml_subs.asp < prev    next >
Encoding:
Text File  |  2003-09-03  |  2.1 KB  |  84 lines

  1. #!/usr/bin/perl /usr/bin/asp-perl
  2.  
  3. <my:include src='header.inc' title="XMLSubsMatch Demo"/>
  4.  
  5. This is a demonstration of the XMLSubsMatch extension which
  6. allows for the developer to construct a set of custom XML style
  7. tags for use in ASP scripts.  These tags could be used 
  8. to render entire XML documents, or even simply give some nice
  9. short cuts for use when site building.
  10. <p>
  11.  
  12. =pod
  13.   This part just to demo embedding normal ASP constructs
  14.   in the XMLsubs, which was no easy trick to implement!
  15. =cut
  16.  
  17. Currently, XMLSubsMatch is set to:
  18. <my:ttb> 
  19.   <% $Response->Write('['); %>
  20.   <%=$Server->Config('XMLSubsMatch')%> 
  21.   <% $Response->Write(']'); %>
  22. </my:ttb>
  23. <p>
  24. Whatever tags XMLSubsMatch matches of the form
  25. <pre><%=
  26. $Server->HTMLEncode('
  27.  <matchtag param1="value1" param2="value2">
  28.    text
  29.  </matchtag>
  30.   -- or --
  31.  <matchtag param1="value1" param2="value2"/>
  32. ')%></pre>
  33.  
  34. will be parsed into perl subroutines of matchtag name with
  35. arguments and text passed in, so these subs would be called
  36. respectively for the above XMLMatchSubs:
  37.  
  38. <pre><%=$Server->HTMLEncode('
  39. &matchtag( { param1 => "value1", param2=>"value2" }, \'text\' );
  40.   -- and --
  41. &matchtag( { param1 => "value1", param2=>"value2" }, \'\');
  42. ')
  43. %></pre>
  44.  
  45. Note that XMLSubs tags of the form <my:ttb>foo:bar</my:ttb> will be changed into a
  46. call to <my:ttb>&foo::bar()</my:ttb>, so that the XML concept of tag prefix
  47. namespaces is translated to the concept of perl packages.
  48. <p>
  49.  
  50. <my:table width=200 title="Title Box" border=3>
  51.   <h3>XML Subs Demo</h3>
  52.  
  53.   Another table here to demo embedded XMLSubs tags:
  54.   <my:table border=1>
  55.     Double Table to Show Embedded Tags
  56.   </my:table>
  57.  
  58.   <p>
  59.  
  60.   And another embedded:
  61.   <my:table border=1>
  62.     Another table.
  63.       <my:table border=1>
  64.         Triply embedded XMLSubs <my:ttb>my:table</my:ttb> table.
  65.       </my:table>  
  66.   </my:table>  
  67.  
  68. </my:table>
  69. <p>
  70.  
  71. <% for("yellow", "red", "blue") { %>
  72.     <my:table bgcolor=$_ width=200 title=ucfirst($_)."Box" border=5>
  73.         Colored Box
  74.     </my:table>
  75.     <p>
  76. <% } %>
  77.  
  78. <p>
  79. The my::* perl subs defining the XMLSubs are located in the 
  80. global.asa.
  81. <p>
  82.  
  83. <my:include src="footer.inc"/>
  84.