Its pretty easy.  Something like this would do it.

   my($section)=substr($ENV{PATH_INFO},1) || 1; # pathinfo has leading /
  
my($output)=apply_templates("/article/section[@id=\"$section\"]/node()");

Brian Wheeler
[EMAIL PROTECTED]




On Mon, 2003-02-03 at 09:20, Geir Amdal wrote:
>   I have just gotten a CVS version of AxKit up and running again¹, and
>   I have a question for those better versed in the intricacies of XPS
>   parsing in connection with a pet project:
>   
>   When using XPathScript to render HTML from XML, I'd like to be able
>   to control which parts are displayed by using the request pathinfo.
> 
>   Consider for instance an XML article 'foo' containing 3 sections after a
>   preamble of metainformation on the article.
>   
> ,----[ foo ]
> | <?xml version="1.0"?>
> | <?xml-stylesheet href="article.xps" type="application/x-xpathscript"?>
> |   <article>
> |     <information>
> |       <title>The Article</title>
> |       <author>The Author</author>
> |       <description>About the article</description>
> |     </information>
> |     <section id="1">
> |       <header>Section 1</header>
> |       <content>Text</content>
> |     </section>
> |     <section id="2">
> |       <header>Section 2</header>
> |       <content>More text</content>
> |     </section>
> |     <section id="3">
> |       <header>Section 3</header>
> |       <content>Even more text</content>
> |     </section>
> |   </article>
> `----
>   
>   My plan is to display a description from the preamble and a listing
>   of sections when the URL http://host/foo is visited, and the
>   different sections when http://host/foo/1, http://host/foo/2 and
>   http://host/foo/3 are visited. Currently I have seen examples using
>   parameters to control which section is displayed, as in
>   http://host/foo?section=2, but none using pathinfo.
>   
>   Given the features of XPS today, is what I have in mind possible?
>   And, if so, does anyone have any suggestions for a way to access the
>   pathinfo from the XPathScript? 
>   
>   
>   Thanks in advance,
> 
>  .gAm
> 
> [¹]  Apache/1.3.27 (Unix) AxKit/1.6_02 mod_perl/1.27
> -- 
> 
>   there are 10 kinds of people in the world;
>     those who read binary, and those who don't.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to