cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Rosenstrauch <dar...@dti.net>
Subject Re: accessing xml elements in xsp
Date Wed, 19 Dec 2001 22:17:28 GMT
Dunno if this will work for you but often what I do is generate my xsp page dynamically (at
compile time, using Ant; not at run time with Cocoon) as the result of applying an XSL sheet
to an XML document.

So basically you'd start with an XML document like this:

>         <frame>
>         <sitemap>
>                 <item id="1">
>                         <files id="1">text.xml</field>
>                         <files id="2">hallo.xml</field>
>                 </item>
>                 <item id="2">Hans</item>
>         </sitemap>


and then just style it as necessary using XSL.

Please note, however:  this is not necessarily the simplest way to accomplish this.  This
method can get quite confusing at times.


HTH.

DR


At 10:57 PM 12/19/01 +0100, you wrote:
>Hi again,
>
>if got another question, where i could not find any solution right now.
>
>I want to access elements of my xsp document. I have the following xsp
>document. i want to access the values of the frame/sitemap/item elements
>with xsp. after this depending on the result i want ether display the value
>"HANS" if SiteID is 2 or load the two files. Has anyone a idea to solve the
>problem!
>
>in the following area is the piece of code i started with!
>
>looking for anser
>
>thanx in advance
>
>WorX
>
><?xml version="1.0" encoding="ISO-8859-1"?>
>
><xsp:page
>           language="java"
>           xmlns:xsp="http://apache.org/xsp"
>           xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>           xmlns:log="http://apache.org/xsp/log/2.0"
>           xmlns:capture="http://apache.org/cocoon/capture/1.0"
> >
>         <frame>
>         <sitemap>
>                 <item id="1">
>                         <files id="1">text.xml</field>
>                         <files id="2">hallo.xml</field>
>                 </item>
>                 <item id="2">Hans</item>
>         </sitemap>
>         <sitemap2>
>                 <xsp:logic>
>                 <![CDATA[
>         String sSiteID = request.getParameter("SiteID");
>         if(sSiteID == null || sSiteID.equals(""))
>         {
>             sSiteID="0";
>         }
>         Integer iSiteID = new Integer(sSiteID);
>         int SiteID;
>
>         SiteID = iSiteID.intValue();
>
>         ]]>
>                 </xsp:logic>
>                 <xsp:element name="Test"><xsp:attribute
>name="ID">Hallo</xsp:attribute>TestValue</xsp:element>
>         </sitemap2>
>   </frame>
></xsp:page>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
>For additional commands, e-mail: <cocoon-users-help@xml.apache.org> 


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.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