Berin Loritsch a écrit :
> 
> Carsten Ziegeler wrote:
> >
> > How would this new component detect if is an xml document
> > or an xsp page?
> 
> On first access, it would catch the very first startElement()
> event.  If it is not:
> 
> // raw parameter may vary
> startElement("http://apache.org/xsp";, "page", "xsp:page", a);
> 
> then execution happens as normal.  If it is, it loads the XSP,
> caches the information that it is an XSP page, and fires the
> rest of the page through the IncludeXMLConsumer.  All subsequent
> requests use the XSP page directly because we have that
> information cached.
> 
> FileGenerator     ProgramGenerator    IncludeXMLConsumer
> -------------     ----------------    ------------------
> |
> +--| isXSP()             |
> |  +-------------------->|
> |<-|                     |
> |
> +--|
> |  | startElement()
> |  |
> |  +--| isXSP()          |
> |  |  +----------------->|
> |  |  |                  |                    |
> |  |  +-------------------------------------->|
> |<-+--| (yes)                                 |
> |  |
> |  | (no)
> |  |
> |  +--------->startElement()
> |<-|
> |
> 
<snip/>

What if there is no <xsp:page>, i.e. you have a clean page where all XSP
markup is inserted by logicsheets ?

IMO, having separate extensions for passive content (.xml files) and
active content (.xsp files) is a good thing. Too much magic kills the
confidence users have in the tool. I speak by experience, because we are
currently redesigning some of our logicsheets so they offer a lower
level of abstraction to their users : they were afraid to use features
that did too much work automagically.

In order to have a single transformation pipeline for both active and
passive sources, a SuffixSelector could do the job :

<map:match pattern="*.html">
  <map:select type="suffix">
    <!-- base name of the file to search for -->
    <map:parameter name="base" value="{1}"/>
    <!-- ordered list of suffixes to search for -->
    <map:parameter name="suffixes" value="xsp, xml"/>
    <map:when test="xsp">
      <map:generate type="serverpages" src="{1}.xsp/>
    </map:when>
    <map:when test="xml">
      <map:generate src="{1}.xml"/>
    </map:when>
  </map:select>
  <map:transform ...

Using this, just change the file extension from xml to xsp to change it
from static to dynamic while keeping the same transformation process.

My .02 euro...
-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

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

Reply via email to