cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruyn Bill" <Bru...@mcao.maricopa.gov>
Subject RE: cinclude usage/alternatives
Date Tue, 21 Feb 2006 11:22:17 GMT
Thanks, Derek.  That's what I thought exactly.  But the aggregation step is the cinclude, yes?
 Am I going about this the right way?  I have something like the following ATM:  (and btw,
any thoughts on the speed issue?  I saw some posts from you a while back on that...)
 
------------
SITEMAP
------------
 
<map:resource name="simple-page2html">
   <map:transform src="context://stylesheets/simple-page2html.xsl">   
    <map:parameter name="contextPath" value="{request:contextPath}"/>
    <map:parameter name="servletPath" value="{request:servletPath}"/>
    <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
    <map:parameter name="file" value="{file}"/>
    <map:parameter name="remove" value="{../0}"/>
   </map:transform>
   <map:transform type="cinclude"/>
</map:resource>
 
...
 
<map:pipeline>
    <map:match pattern="presentation-template">
    <map:generate type="file" src="http://dev.drugfreeaz.com/treatment_ctrs/drugfreeaz.xhtml"/>
    <map:transform src="context://stylesheets/dreamweavertemplate-page2html.xsl"/>
    <map:serialize type="xml"/>
   </map:match>
</map:pipeline>
 
<map:pipeline>
   <map:match pattern="forms/view/*.jx">
    <map:generate type="jx" src="forms/view/{1}.xml" label="content1">
     <map:parameter name="locale" value="{flow-attribute:locale}"/>
    </map:generate>
    <map:transform type="browser-update"/>
    <map:call resource="simple-page2html">
     <map:parameter name="file" value="forms/view/{1}.xml"/>
    </map:call>
    <map:transform type="i18n">
     <map:parameter name="locale" value="{flow-attribute:locale}"/>
    </map:transform>
    <map:transform src="context://stylesheets/forms-styling.xsl"/>
    
    <map:select type="ajax-request">
     <map:when test="true">
      <map:serialize type="xml"/>
     </map:when>
     <map:otherwise>
      <map:serialize type="html"/>
     </map:otherwise>
    </map:select>
   </map:match>
</map:pipeline>
 
---------------------------------------------
forms/view/find.xml
---------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
  <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
  <title>Find Treatment Provider</title>
  <content>
    
    <h4> Enter search criteria to find a provder that best suits your needs.  
      You'll need to supply part of a provider name <i>or</i> a search area (zip
code), 
      but the rest of the options are optional.
    </h4>
    
    <ft:form-template action="#{$continuation/id}.kont" method="POST" ajax="true">
      <fi:group>
        <fi:label>Search Criteria</fi:label>
        <fi:styling type="fieldset" layout="columns"/>
        <fi:items>
          <ft:widget id="rowCount"/>
          <ft:widget id="organizationName"/>
          <ft:widget id="zipcode"><fi:styling size="8" maxlength="5"/></ft:widget>
          <ft:widget id="addictionTreated"/>
          <ft:widget id="careBasis"/>
          <ft:widget id="paymentOption"/>
          <ft:widget id="specialInterests">
            <fi:styling list-type="checkbox"/>
          </ft:widget>
        </fi:items>
      </fi:group>
      <p/>
      <center>
        <jx:if test="${cocoon.request.getUserPrincipal() != null}">
          <input type="button" value="Create" onClick="javascript:window.open('add.flow');"/>
        </jx:if>
        <input type="submit" value="Search"/>
      </center>
      <p/>
    </ft:form-template>
  </content>
</page>
 
---------------------------------------------
dreamweavertemplate-page2html
---------------------------------------------
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns:html="http://www.w3.org/1999/xhtml" exclude-result-prefixes="html">
  
  <!-- The identity transform -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  
  
  <xsl:template match="html:td[@class='main-body']">
    <!-- copy the element in question -->
    <xsl:copy >
      <xsl:apply-templates select="@*"/>
      <!-- and wrap our dynamic content in it --> 
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  
</xsl:stylesheet>
 
---------------------------------------------
simple-page2html
---------------------------------------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:inc="http://apache.org/cocoon/include/1.0"
xmlns:html="http://www.w3.org/1999/xhtml">
  <xsl:param name="contextPath"/>
  <xsl:param name="servletPath" select="string('/drugfreeaz')"/>
  <xsl:param name="sitemapURI"/>
  <xsl:variable name="directory" select="substring-before($servletPath,$sitemapURI)"/>
  <!-- assume that sitemapURIs don't occur in servletPath more than once -->
  <xsl:variable name="sitemap" select="concat($directory,'sitemap.xmap')"/>
  
  <xsl:template match="page">
     <inc:include src="cocoon:/presentation-template"/>
  </xsl:template>
  <xsl:template match="title">
    <h2>
      <xsl:apply-templates/>
    </h2>
  </xsl:template>
...
...
 
 

 
________________________________

From: Derek Hohls [mailto:dhohls@csir.co.za]
Sent: Tue 2/21/2006 12:04 AM
To: users@cocoon.apache.org
Subject: Re: cinclude usage/alternatives



Bill

Just 2c worth of thought from the side.  I am not sure I understand your problem
as a whole... but can you not have a pipeline with an aggregation step in it;
one part of the aggregate is the static file below, and the other is a pointer to
the pipeline that generates the dynamic data.  You can then run the aggregated
xml through a normal transform to get your result... "looking up" the dynamic
section and adding it in to the <td class="webapp"></td> element (basic XSL).

Just an idea.
Derek

>>> Bruynb@mcao.maricopa.gov 2006/02/21 07:01:17 AM >>>

For various reasons, I need to retrieve some markup from a remote resource, and insert my
jx result inline.  e.g., I have some remote file called wrapper.xhtml that looks like

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>
    <body>
      <table>
        <tr>
          <td>Here is some static content</td>
          <td class="webapp">and a placeholder for dynamic stuff</td>
        </tr>
      </table>
    </body>
</html>

Where I need to replace the contents of //td[@class='webapp'] with 'whatever'.  It isn't the
way I would have chosen to put it together, but it seems like a reasonable requirement that
I should be able to handle with the sitemap and a cinclude transform.  Right?

No luck though with several hours of experimentation and the usual looking through google,
samples, wiki, archives, userdoc, etc.  BTW, the cinclude is really very slow...  Is this
the recommended method, or am I barking up the wrong tree here?


TIA,

Bill
--------------------------------------------------------------------- To unsubscribe, e-mail:
users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org


--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.

CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html

CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html

For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
HelpDesk@csir.co.za.


This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org




Mime
View raw message