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 [EMAIL PROTECTED] To: <[EMAIL PROTECTED]> 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: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>
Re: Java variable inside of document() function?
Christopher Painter-Wakefield Thu, 16 Aug 2001 14:35:37 -0700
- Java variable inside of document() function? Martin Benda
- Christopher Painter-Wakefield
