xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: XSP usage question
Date Mon, 28 Feb 2000 16:56:11 GMT
Yahoo wrote:
> 
> I'm trying to better figure out how to dynamically generate XML
> documents, particularly with data from a database. I've read
> the XSP documentation that I could get a hold of and I have a
> question about it's usage.
> 
> Would <xsp:element> and <xsp:attribute> be used to replace a
> variable in a dynamically generated page? 

Not alone, you have to use <xsl:expr> to evaluate a logic expression.
for example

 <xsp:element name="contender">
 
<xsp:expr>getContender(request.getParameter("contender-name"))</xsp:expr>
 </xsp:element>

suppose you have java as your logic, you would get

 <contender>Prada</contender>

after execution of "contender.xml?contender-name=Prada". A stupid
example, but shows my point.
 
> For example, if I had
> a database of America's Cup contenders (to choose something some
> of you might be interested in) 

I am, go "luna rossa" :)

> could I have a page, which through
> XSP, maybe <example:contenders/>, a tag which through a library
> would connect via JDBC to a DB of America's Cup contender data
> and make a list of contenders linking to a data page. 

Yes. You'd have to transform that tag into some XSP tags that include
the logic for database access or use the database taglibs (that will be
provided in the future)

> So the
> result would be <a href="data.xml" contender=foo>foo</a> after
> XSLT transformation. 

Well this is up to you... you should do something like

 <xsp:element name="a">
  <xsp:attribute name="href">data.xml</xsp:attribute>
  <xsp:attribute name="contender">
   <xsp:expr>getContender()</xsp:expr>
  </xsp:attribute>
  <xsp:expr>getContender()</xsp:expr>
 </xsp:element>

> data.xml would have XSP in it with <xsp:attribute
> name="contender"></xsp:attribute>, in several places, ideally.

see above.

> These attribute tags would be in logic to embed applications
> specific to the particular contender, like survey questions about
> them, chats about them, etc.

yep
 
BTW, forward XSP questions to the Cocoon mail lists next time.

> Thanks for the help.
> 
> Josh
> 
> ----------------
> Sent from a WebBox - http://www.webbox.com
> FREE Web based Email, Files, Bookmarks, Calendar, People and
> Great Ways to Share them with Others!


-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message