Hi,
I have been playing with AxKit for several months now, and found it
very exciting and an elegant solution to many problems I face
everyday. At the moment, I am gettings familliar with XSP.
When I first started using AxKit, I tried to use XSP and found it
frusterating. I wanted to use XSP to generate XML to feed to a
stylesheet. Eventually, I gave up and used Mason, which I am more
familliar with, and Apache::Filter to feed the mason output to a
stylesheet I had written.
Now I would like to go back and replace mason ---> axkit xslt with
axkit xsp ---> axkit xslt. I haven't found too many useful examples,
but have not had any major problems so far...except for this one,
which is probably a conceptual problem on my part.
On a particular page, I had an xml schema that looked like this:
<catgeory name="Dummies">
<book cover="cover.jpg"
>Being a Dummy for Dummies</book>
</category>
I fed this to a stylesheet I had written, which generated an HTML
table of books, seperated into categories.
My next step was to use mason to generate the XML, from a
database. In mason, I might query a database to get data, and then:
% while (my $cat = $categories_rs->fetchrow_arrayref) {
<category name="<% $cat->[0] %>">
% while (my $book = $books_rs->fetchrow_arrayref) {
<book cover="<% $book->[1] %>"
><% $book->[0] %></book>
% }
</category>
% }
My question is, how can I set the attributes of theses elements
using XSP? I sense a conceptual leap coming, and am hoping someone
will give me a push. I have:
<?xml version="1.0"?>
<?xml-stylesheet href="." type="application/x-xsp"?>
<?xml-stylesheet href="books.xsl" type="text/xsl"?>
<xsp:page
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:esql="http://apache.org/xsp/SQL/v2"
xmlns="uri://my.homepage.com/NS/BooksPage"
language="Perl">
<page>
<body>
<esql:connection>
<esql:driver>Pg</esql:driver>
<esql:dburl>dbname=mainsite</esql:dburl>
<esql:username>nobody</esql:username>
<esql:execute-query>
<esql:query>
select category_id, name
from category
</esql:query>
<esql:results>
<esql:row-results>
<category name="<esql:get-string
column='name'/>"
<!-- add book elements
after I get the
categories worked out -->
</category>
</esql:row-results>
</esql:results>
</esql:execute-query>
</esql:connection>
</body>
</page>
</xsp:page>
...but obviously the part <<id="<esql:get-string column='name'/>">>
is wrong. Any ideas? Thanks, and sorry for the verbosity of the post.
--
--chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]