Hi,

I had a similar question a week ago. The replys were really helpful and lead to the 
following code. Thanks a lot. But I do have further problems without any idea how to 
solve them or if it is even possible with cocoon. Therefore, I am looking for some 
suggestions how to proceed.
I have the files below whereas examples.xsp is my main file. The tag 
<vormsexample:link> is used to execute a request to a database returning the URI (to a 
file) for the passed identifier. In this case, the database request would return 
bibliography.xml (a little bit simplified for this mail but basically we get an URI 
which is valid and usable by cocoon). Within the xml-file another tag 
<vormsexample:link> has to be resolved to an URI which is NOT working in this example. 
For my understanding, when I do use the document(.) function (see the file 
example.xsl), the referred xml file is included and be parsed as a part of the 
original file.

My problems are

1) The bibliography.xml file is included and parsed (xsl:template match="bibliography" 
 in author.xsl is found and executed) but the match="vormsexample:link" for the tag 
<bibauthor> does not work  (i.e. the xsl:template match="vormsexample:link" in 
example.xsl is not called again).

2) Assuming xsl:template match="vormsexample:link" in example.xsl  would be called, I 
have to assure that the xsp:expr is resolved as before inserting further files in a 
recursive loop.

We use Cocoon 2.0.1 and Tomcat 4.0.2.

We have to implement a solution during the next week, therefore I would appreciate 
your suggestions. If you have further questions what we are trying to do, please let 
me know so I can give further explainations

Thanks a lot,
Torsten

-------------------------------------------------------------------------------------------------------------

We havbe the following files:

********************************************************
******************* examples.xsp ********************
********************************************************

  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsp:page
          language="java"
          xmlns:xsp="http://apache.org/xsp";
          xmlns:vormsexample="http://www.vorms.org/xsl"; >
  <vormsexample:header/>
  <page>
        <vormsexample:link identifier="LO_VORMS_TP3_BIBLIOGRAPHY_SMITH01_1_1"/>
  </page>
</xsp:page>


********************************************************
******************* bibliography.xml *****************
********************************************************

  <bibliography>
     <bibauthor>
           <vormsexample:link identifier="LO_VORMS_TP3_AUTHOR_JOHNSMITH_1_1"/>
     </bibauthor>
  </bibliography>

********************************************************
******************* author.xml ***********************
********************************************************

  <author>
        <person role ="male">
                <firstname>John</firstname>
                <othername></othername>
                <surname>Smith</surname>
        </person>
  </author>


********************************************************
******************* example.xsl *****************
********************************************************
  <?xml version="1.0"?>

  <xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xsp="http://apache.org/xsp";
                xmlns:vormsexample="http://www.vorms.org/xsl"; >
  <xsl:include href="author.xsl"/>

  <xsl:template match="vormsexample:header">
    <xsp:structure>
        <xsp:include>DBInterface</xsp:include>
    </xsp:structure>

    <!-- Insert code to the xsl-file to read the uri of the file
       containing the data corresponding to the passed identifier -->
    <xsp:logic>
      public synchronized String getURI(String identifier)
       {
       DBInterface dbinterface = new DBInterface();
      
dbinterface.establishConnection("jdbc:mysql://134.169.75.183/vorms","vorms","vorms");
      String msg = "file://" +  dbinterface.getURIForLM(identifier);
      return msg;
      }
     </xsp:logic>
   <xsl:apply-templates/>
 </xsl:template>

 <xsl:template match="page">
   <page>
     <xsl:apply-templates/>
     </page>
 </xsl:template>

 <xsl:template match="vormsexample:link">
        <toInsert>
                <xsp:expr>getURI("<xsl:value-of select="@identifier"/>")</xsp:expr>
        </toInsert>
        <xsl:apply-templates />
 </xsl:template>

 <xsl:template match="toInsert">
        <xsl:apply-templates select="document(.)" />
 </xsl:template>

 <xsl:template match="@*|node()" priority="-1">
        <xsl:copy>
              <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
 </xsl:template>
</xsl:stylesheet>

********************************************************
******************* author.xsl ************************
********************************************************

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:vormsexample="http://www.vorms.org/xsl";>


<xsl:template match="bibliography">
   <xsl:for-each select="bibauthor">
      <xsl:apply-templates select="vormsexample:link"/>
   </xsl:for-each>
</xsl:template>

<xsl:template match="author">
   author
</xsl:template>

</xsl:stylesheet>

-- 

                        __  __
                       _ OO\| O__
                        O\__/O / O
           /////        O O\ /
           O O              |
-----.oOOo------oOOo.---------------------------------
Torsten Reiners           Tel:++49-531-3913214
[EMAIL PROTECTED]        Fax:++49-531-3918144
http://server3.winforms.phil.tu-bs.de/~treiners

TU Braunschweig
Abteilung Allgemeine Betriebswirtschaftslehre,
 Wirtschaftsinformatik und Informationsmanagement
Abt-Jerusalem-Str.7
38106 Braunschweig, Germany

Other EMails:  [EMAIL PROTECTED]
                    [EMAIL PROTECTED]
------------------------------------------------------


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to