DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Fragment(3)





NAME

       Apache::AxKit::Plugin::Fragment - Fragment plugin


SYNOPSIS

         AxAddPlugin Apache::AxKit::Plugin::Fragment


DESCRIPTION

       This module provides direct web access to XML fragments, using an XPath
       syntax. By simply providing a querystring containing an XPath query,
       this module will set the XML to be parsed to be the XML nodes returned
       by the query. The nodes will be wrapped in either <result-
       set>...</resultset> or you can specify the outer tag using:

               PerlSetVar XPathFragmentElement foo

       to wrap it in <foo>...</foo>.


USAGE

       Simply add this module to the plugin list before StyleFinder:

               PerlHandler Apache::AxKit::Plugins::Fragment \
                               AxKit

       Then request a URL as follows:

               http://server/myfile.xml?/some/xpath/query

       Queries that match the regular expression: ^\w+= are ignored, as are
       any invalid XPath queries.

       Note that it's important to write your stylesheet to make use of this
       capability! If you intend to use this Fragment plugin, you can't assume
       that your stylesheet will just magically work. It will have to not make
       assumptions about the XML being passed into it. The apply_templates()
       method of XPathScript is extremely useful here, as is the xpath query
       'name(/child::node())' which identifies the top level element's name.
       Here's how I got around this with my first experiments with this:

               <!-- Main document body -->
               <% if (findvalue('name(/child::node())') eq 'page') { %>
                       <%= apply_templates('/page/body/section') %>
               <% } else { %>
                       <%= apply_templates('/') %>
               <% } %>

       Which checks that the top level element is called 'page', otherwise it
       simply does apply_templates() on all the nodes.

perl v5.8.6                       2002-07-30Apache::AxKit::Plugin::Fragment(3)

Man(1) output converted with man2html