Example 17-18: Modified News.xsql file that handles forumuser cookie

<?xml version="1.0"?>
<!-- News.xsql: Data page driving the news portal -->
<?xml-stylesheet type="text/xsl" href="News.xsl"?>
<page connection="xmlbook" xmlns:xsql="urn:oracle-xsql">
  <xsql:set-cookie name="forumuser" value="{@youremail}"
                   ignore-empty-value="yes" only-if-unset="yes"/>
  <xsql:set-page-param name="forumuser" value="{@youremail}"
                       ignore-empty-value="yes"/>
  <xsql:include-param name="forumuser"/>
  <xsql:query rowset-element="STOCKS">
    select ticker,to_char(price,'999.99') as price
      from latest_quotes
      where trunc(day) = (select max(trunc(day)) from latest_quotes)
        and ticker IN (SELECT ticker
                         FROM user_stocks
                        WHERE userid = NVL('{@forumuser}','DEFAULT'))
      order by ticker
  </xsql:query>
  <xsql:query><![CDATA[
    SELECT cat.id,
           cat.name,
           CURSOR( SELECT title,url,description
                 FROM latestnews
                WHERE category = cat.id
                  AND ROWNUM <= (SELECT headlines
                                   FROM user_prefs
                                  WHERE userid = NVL('{@forumuser}','DEFAULT'))
           ) AS stories
     FROM site_newscategory cat
      WHERE cat.id IN (SELECT category
                         FROM user_news_categories
                        WHERE userid = NVL('{@forumuser}','DEFAULT'))
  ]]>
  </xsql:query>
</page>