I'm finding frustration trying to use the second parameter of the document function. (I'm using xalan 2.7.0) It seems like it ought to be a simple, useful, and intuitive thing, but damned if I can get it to work, or find a good example of it anywhere, from Michael Kay's book to the internet.
I've got an attribute from the XML I'm processing that gives me a filename, just a filename, because it's local relative to the document being processed. I've also got a parameter to the stylesheet (curPath) with the base URI from which to find the file. My xlst looks like: <xsl:apply-templates select="document(@filename, $curPath )/*" /> This results in: SystemId Unknown; Line #0; Column #0; org.apache.xml.utils.WrappedRuntimeException: Can not convert #STRING to a NodeList! So, okay, the documentation does indicate that this parameter should be a nodeset rather than the simple string one might expect. So I try the below (adding a message line to verify the parameter value): <xsl:message>The path param is<xsl:value-of select="$curPath"/></xsl:message> <xsl:apply-templates select="document(@filename, xalan:nodeset($curPath)/*" /> file:///C:/work/code/project_a/src/java/com/wrycan/ntm/contenttools/volume_assembler.xsl; Line #15; Column #16; The path param isfile:/C:/project_a/xmlWork/NTM/SUBSYSTEM/ file:///C:/work/code/project_a/src/java/com/wrycan/ntm/contenttools/volume_assembler.xsl; Line #17; Column #102; Can not load requested doc: C:\work\code\project_a\chapter_1.xml (The system cannot find the file specified) So still it's looking for the file in the current working directory (I'm launching java from a command prompt as C:\work\code\project_a), not the directory specified in the second document parameter. Am I doing something stupid here? Or am I right in thinking that the 2 argument version of the document function is broken? Incidentally I tried this using org.apache.xalan.xslt.Process from the command line rather than my own code to make sure it wasn't something in my java. Using jdk 1.5.0. I can get it to work just using string concatination and the one argument version of the function, but it seems stupid to have to do this when the function offers an argument explicitly for this purpose. <xsl:apply-templates select="document(concat($curPath, @filename))/*" mode="content_asset"> So I have a work-around, but I'd really like to resolve whether the other way is broken or if I'm doing something flawed. Thanks, Eric