cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Painter-Wakefield" <paint...@mc.duke.edu>
Subject Re: Java variable inside of document() function?
Date Thu, 16 Aug 2001 22:02:06 GMT

Martin,

first, are you trying to do this in a logicsheet or in a stylesheet?  In a
logicsheet, this won't work because your logicsheet exists to generate Java
code.  The Java code doesn't exist and hasn't been compiled and can't run
yet.  Only your XSL transformations are being applied.  The <xsl:for-each
select="document([the Java variable])"> can't use the value stored in the
Java variable, because it doesn't exist yet.

In a stylesheet, you can't do this, because you can't use XSP Java code in
a stylesheet.  It is too late.  All XSP code has already been run,
producing XML which is being processed by your stylesheet.  You can,
however, do this:

In your XML file:
...
<xsp:logic>
<!-- do something here to set your variable, e.g. -->
String doc = "info.xml";
</xsp:logic>

<doc><xsp:expr>doc</xsp:expr></doc>
...

then in your XSL stylesheet:
<xsl:variable name="thefile" select="doc"/>
<xsl:for-each select="document($thefile)">
...

-Christopher




Please respond to cocoon-users@xml.apache.org

To:   <cocoon-users@xml.apache.org>
cc:

Subject:  Java variable inside of document() function?


How can I use a Java variable in the document() funkction?

i.e.
<xsl:for-each select="document([the Java variable])">
 ...
</xsl:for-each>

I have tried it with the help of

<xsl:variable name="src"><xsp:expr>[the Java
variable]</xsp:expr></xsl:variable>
<xsl:for-each select="document([$src])">
 ...
</xsl:for-each>

but this doesn't work. <xsp:expr/> won't be processed and so the value of
$name is
the String "src". When I use <xsp:expr>src</xsp:expr> outside of
<xsl:variable/> it
works fine.

How can I solve this problem? Is there any workaround?

Thanks,
Martin





---------------------------------------------------------------------
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