NoContent generator
A generator which does not return any content. It is the default generator used when no class is specified for a generator in services.xml.
Default generator
This generator is the default generator when the class attribute is specified for a generator in services.xml
.
<service id="do-nothing" method="get"> <url pattern="/empty"/> <generator name="empty"/> </service>
The service configuration above is the equivalent of
<service id="do-nothing" method="get"> <url pattern="/empty"/> <generator name="empty" class="org.pageseeder.berlioz.generator.NoContent"/> </service>
Output
The NoContent generator does not generate any content.
The example above would result in the following raw output from Berlioz:
<root service="topic" group="default"> <header> <location scheme="http" host="example.org" port="80" path="/empty.html" query="" base="http://example.org"> http://example.org/empty.html </location> <path info="/empty" extension=".html"/> <http-parameters/> <uri-parameters/> <berlioz version="0.10.2" mode="web"/> </header> <generator name="empty" class="org.pageseeder.berlioz.generator.NoContent"/> </root>
Usage
This generator is useful in cases when a specific template rule should be applied by XSLT but that template does not use any content from the source XML. In other words, the template itself defines all that it needs to output.
Example
A Web site has a common HTML footer defined as a template in XSLT but that footer should not appear on all pages. An easy way to define on which pages the footer should be displayed is to include the footer generator in the service.
XSLT
<xsl:template match="content[@name='footer']"> <footer>© 2016 example.org</footer> </xsl:template>
Services.xml
<service id="home" method="get"> <url pattern="/home"/> <generator name="bundler" class="org.pageseeder.berlioz.bundler.GetWebBundles"/> <generator name="content" class="org.example.GetPageContent"/> <generator name="footer"/> </service>
Created on , last edited on