cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew C. Oliver" <acoli...@apache.org>
Subject Re: XInclude/CInclude Issue (Re: including dynamic data with XMLForm)
Date Sun, 07 Jul 2002 19:34:09 GMT
Hi,

Thanks for your reply.  This is very close to what I want.
So I'm almost there, but I have to have a root element on the 
categories_combo.xml "page".  Its <xmlformcategories>.  I only
want whats in between the root element.  CInclude appears to not
support the xpointer as it was trying to treat it as part of the URL.
I'd hoped that the "element" attribute of the <cinclude:include> tag
would allow this, but it actually seems to be for doing the opposite.  
I suppose I can apply an additional layer of transformation that takes
the output, includes everything but the <xformcategories> and then 
includes its children, but that is very inefficient and kinda of a pain,
etc.  

Is there a more straightforward way to take only the children of the
xmformcategories, include them without including the xmlformcategories
tag?

basically

<cinclude:include src="cocoon:/categories_combo.xml"
select="xformcategories/*"/>

or something to that effect


source of requestform.xml:

<?xml version="1.0"?>

    <document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002"
              xmlns:cinclude="http://apache.org/cocoon/include/1.0">

      <xf:form id="request-form" view="requestform"
action="postrequest.html">

        <error>
          <xf:violations class="error"/>
        </error>

        <xf:selectMany ref="/category" selectUIType="listbox">
            <xf:caption>Category</xf:caption>
            <cinclude:include src="cocoon:/categories_combo.xml" />
            <xf:violations class="error"/>
        </xf:selectMany>

        <xf:textbox ref="/title">
            <xf:caption>Title/Item Name (no HTML)</xf:caption>
            <xf:violations class="error"/>
        </xf:textbox>

.... snip ....


        <xf:textbox ref="/password">
            <xf:caption>Password</xf:caption>
            <xf:violations class="error"/>
        </xf:textbox>

        <xf:submit id="next" class="button">
          <xf:caption>Next</xf:caption>
        </xf:submit>

      </xf:form>
      
    </document>
                    

output from categories_combo.xml:

<xformcategories xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
<xf:item>

<xf:caption>Original Art</xf:caption>
<xf:value>16</xf:value>
</xf:item>
<xf:item>
<xf:caption>Antiques</xf:caption>
<xf:value>0</xf:value>
</xf:item>
<xf:item>
<xf:caption>Books</xf:caption>
<xf:value>1</xf:value>
</xf:item>

<xf:item>
<xf:caption>Cars</xf:caption>
<xf:value>2</xf:value>
</xf:item>
<xf:item>
<xf:caption>Collectibles</xf:caption>
<xf:value>3</xf:value>
</xf:item>
<xf:item>
<xf:caption>Comics</xf:caption>
<xf:value>4</xf:value>

</xf:item>
<xf:item>
<xf:caption>Computers</xf:caption>
<xf:value>5</xf:value>
</xf:item>
<xf:item>
<xf:caption>Crafts</xf:caption>
<xf:value>6</xf:value>
</xf:item>
<xf:item>
<xf:caption>Electronics</xf:caption>
<xf:value>7</xf:value>

</xf:item>
<xf:item>
<xf:caption>Gifts</xf:caption>
<xf:value>8</xf:value>
</xf:item>
<xf:item>
<xf:caption>Loans</xf:caption>
<xf:value>9</xf:value>
</xf:item>
<xf:item>
<xf:caption>Music</xf:caption>
<xf:value>10</xf:value>

</xf:item>
<xf:item>
<xf:caption>Office Supplies</xf:caption>
<xf:value>11</xf:value>
</xf:item>
<xf:item>
<xf:caption>Other</xf:caption>
<xf:value>12</xf:value>
</xf:item>
<xf:item>
<xf:caption>Toys</xf:caption>
<xf:value>13</xf:value>

</xf:item>
<xf:item>
<xf:caption>Travel</xf:caption>
<xf:value>14</xf:value>
</xf:item>
<xf:item>
<xf:caption>Videos</xf:caption>
<xf:value>15</xf:value>
</xf:item>
</xformcategories>


-Andy


On Sun, 2002-07-07 at 14:59, Stephan Michels wrote:
> 
> On Sun, 7 Jul 2002, Ivelin Ivanov wrote:
> 
> >
> > We could use some help from the XInclude/Cinclude experts for
> > the problem Oliver is trying to solve.
> >
> >
> > ----- Original Message -----
> > From: "Andrew C. Oliver" <acoliver@apache.org>
> > To: "cocoon users" <cocoon-users@xml.apache.org>
> > Sent: Sunday, July 07, 2002 12:17 PM
> > Subject: Re: including dynamic data with XMLForm
> >
> >
> > > Hi Ivelin,
> > >
> > > Thanks for your reply.
> > >
> > > This isn't quite quite working.  It seems to insist on resolving to a
> > > file.
> > >
> > > ERROR   (2002-07-07) 09:08.29:743   [sitemap]
> > > (/cocoon/samples/bringmethis/action/postrequest.html)
> > > Thread-45/XIncludeTransformer: Error in processXIncludeElement
> > > org.apache.cocoon.ResourceNotFoundException: Resource not found.:
> > > org.apache.excalibur.source.SourceNotFoundException: Resource not found
> > >
> > file:/opt/tomcat/webapps/cocoon/samples/bringmethis/content/form/categories_
> > combo.xml
> 
> If I unterstand you right, categories_combo.xml should be generated by the
> sitemap. But XInclude transformer tries to read the file from the
> filesystem.
> 
> 
> > > My xinclude statement reads currently as follows:
> > >
> > >
> > >
> > >    <map:match pattern="action/categories_combo.xml">
> > >     <map:generate src="content/dynamic/categories.xsp"
> > > type="serverpages"/>
> > >     <map:transform src="stylesheets/categories2combo.xsl"/>
> > >     <map:serialize type="html"/>
> > >    </map:match>
> > >
> > >
> > > my xform page reads:
> > >
> > >         <xf:selectMany ref="/category" selectUIType="listbox">
> > >             <xf:caption>Category</xf:caption>
> > >             <xi:include
> > > href="categories_combo.xml#xpointer(/xformcategories)"/>
> 
> I think you should use cocoon://categories_combo.xml instead, and
> use the CInclude transformer.
> 
> > >             <xf:violations class="error"/>
> > >         </xf:selectMany>
> > >
> > >
> > > (this isn't exactly where I want it but I figured I'd move back if I got
> > > it working).
> > >
> > > Note the pointer is because I need to have a root element to make the
> > > document valid.  I'd rather not make my root element the selectMany.
> > >
> > > Thanks,
> > >
> > > Andy
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 
-- 
http://www.superlinksoftware.com - software solutions for business
http://jakarta.apache.org/poi - Excel/Word/OLE 2 Compound Document in
Java                            
http://krysalis.sourceforge.net/centipede - the best build/project
structure
		    a guy/gal could have! - Make Ant simple on complex Projects!
The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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


Mime
View raw message