Subject: [xsl] Parameter evaluation after use of document() From: Yves Forkl <Yves.Forkl@xxxxxxx> Date: Sun, 28 Jul 2002 20:50:05 +0200 |
Hi, I am wondering why the XSLT code below doesn't work. Xalan-J dies with the (not very helpful) errors mentioned below as soon as it tries to get the value of "filename_base" in the second last line in the stylesheet excerpt. It seems that the parameter value has somehow been lost at that point - I suspect that the problem is related to the fact that I'm processing nodes obtained by using document(). FAQs and literature didn't tell much about that topic. Can anybody give me a clue on what is wrong with my stylesheet? (I've simplified it a little bit.) Regards, Yves Forkl ++++++++++ content of file "Chapter_1.xml" ++++++++++ <?xml version="1.0" encoding="iso-8859-1"?> <!-- ... --> <!-- ... --> <chapter id="Chapter1_ID"> <title>My First Chapter</title> ... </chapter> ++++++++++ excerpt of stylesheet ++++++++++ <!-- value of $type is not relevant --> <!-- process all element nodes of type $type --> <xsl:for-each select="key('select_nodes_by_type', $type)"> <xsl:call-template name="generic_info_template"> <!-- extract the text node of the each element node of type $type --> <xsl:with-param name="filename_base" select="text()"/> <!-- SUPPOSE: 1st run: $filename_base = "Chapter_1" --> </xsl:call-template> </xsl:for-each> <!-- apply appropriate info_mode templates to file contents --> <xsl:template name="generic_info_template"> <xsl:param name="filename_base"/> <!-- read in file contents and process them in info_mode --> <xsl:apply-templates select="document(concat($filename_base, '.xml'))" mode="info_mode"> <!-- hand the param to the called template --> <xsl:with-param name="filename_base" select="$filename_base"/> </xsl:apply-templates> </xsl:template> <!-- write out info specifically for chapter nodes --> <xsl:template match="chapter" mode="info_mode"> <xsl:param name="filename_base"/> <xsl:text>This chapter's title: </xsl:text> <xsl:value-of select="title"/> <xsl:text> This chapter's filename base: </xsl:text> <xsl:value-of select="$filename_base"/> </xsl:template> ++++++++++ fatal error messages by Xalan-J ++++++++++ (always occurring at the above stylesheet's second last line) * with option -TS: (default root rule) apply-templates, select='null': 1000001: #comment 1000002: #comment 1000003: chapter (Location of error unknown)XSLT Error (javax.xml.transform.TransformerException) : java.util.EmptyStackException * with options -TG or -TT or -TTC: (Location of error unknown)XSLT Error (javax.xml.transform.TransformerException) : java.lang.reflect.InvocationTargetException XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] ampersands in URL as attr, David Carlisle | Thread | Re: [xsl] Parameter evaluation afte, Oleg Tkachenko |
RE: [xsl] Re: xslt critique, bryan | Date | Re: [xsl] Parameter evaluation afte, Oleg Tkachenko |
Month |