This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FW: problem with passing parameters


Marco --

Remove the quotes from around '$layout' in the document() function. 
This is causing document() to try to load a file named $layout.  Also,
be sure your command line has

	-PARAM layout "'file...'"

The newest version of Xalan (1.2.D01) will replace the #UNKNOWN with the
proper type in the error message.  However, removing the quotes should
do the trick.

You'll also have a problem with your select="$layout/html".  Not sure
what you're trying to
do here but I think you mean $page/html.

Gary


Marco.Mistroni@nokia.com wrote:
> 
> Hi Steve,
>         please ignore my previous message
> i got the following problem:
> i want to use the document() function in my XSL stylesheet
> the name of hte document must be provided dynamically at run time
> my stylesheet looks like this:
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:param name="layout" select="'default'"/>
> <xsl:variable name="page" select="document('$layout') />
> 
> <xsl:template match="/">
>         <xsl:apply-templates select="$layout/html" />
> </xsl:template>
> 
> <xsl:template match="insert-body">
>         <xsl:apply-templates select="$page/content/*" />
> </xsl:template>
> 
> <xsl:template match="content" >
>         hello
> </xsl:template>
> 
> <xsl:template match="@*|*">
>         <xsl:copy>
>                 <xsl:apply-templates select="@*|node()" />
>         </xsl:copy>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> what i want to do:
> - i want to set a parameter with the name of an XML file and then apply the
> document() function
> 
> Due to the error that i am receiving, i decided to make it longer, by
> setting one parameter with the name of the file
> and then creating a variable that applies the document() function to the
> parameter (i have tried also the shortest way)
> 
> the parameter value is  file:///c:\\marcodev\layouthtml.xml
> 
> whenever i run my stylesheet, i got the following exception:
> 
> XSL Error: SAX Exception
> There was a SAX Exception!
> org.apache.xalan.xslt.XSLProcessorException: Can not convert #UNKNOWN to a
> NodeL
> ist!
>         at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
>         at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1594)
>         at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java,
> Com
> piled Code)
> 
> i am using Xalan, latest version
> when i set the stylesheet, the parameter value is "'file........ '"  (the
> file name between quotes)
> i don't understand what is the #UNKNOWN
> 
> can anyone help me please????
> thanx in advance & best regards
>         marco


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]