Hi Colin,
You are forgetting that a parameter is an XPath expression, so if you want
a string literal, you must make sure you are using ' or " to delimit the
string:
"strange"
as opposed to:
strange
Otherwise, Xalan interprets the parameter as a location path. Also, you
probably meant:
<xsl:param name="document-element" select="'dummy'" />
instead of:
<xsl:param name="document-element" select="dummy" />
Dave
Colin Paul Adams
<[EMAIL PROTECTED] To:
[email protected]
mon.co.uk> cc: (bcc: David N
Bertoni/Cambridge/IBM)
Subject: Problem passing
parameters
02/24/2003 09:32
AM
Using the latest CVS version (updated an hour ago), I am having
problems passing parameters to a stylesheet. I am using the following
code to set a parameter:
void xalanc_set_stylesheet_parameter ( const XMLCh * value, const XMLCh*
key )
{
std::cerr << "Key is " << XMLString::transcode ( key ) << ", value is "
<< XMLString::transcode ( value ) << std::endl;
xalan.setStylesheetParam ( XalanDOMString ( key ), XalanDOMString (
value ) );
}
(Note that the input parameters are Xerces DOM strings)
which produces the following (correct) output at runtime:
Key is document-element, value is strange
But when the transform is called, using the following stylesheet:
<?xml version='1.0'?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:test="urn:colina.demon.co.uk:domwriter-test-one"
>
<xsl:param name="document-element" select="dummy" />
<xsl:template match="/">
<xsl:message>
<xsl:text>Value of document-element parameter is
</xsl:text><xsl:value-of select="$document-element" />
</xsl:message>
<xsl:element name="{$document-element}" />
</xsl:template>
</xsl:transform>
I get the following warnings:
XSLT message: Value of document-element parameter is , source tree node:
#document (file:///home/colin/colina/EDOM/data/transform3.xsl, line 8,
column 18)
XSLT warning: Illegal element name, source tree node: #document (
file:///home/colin/colina/EDOM/data/transform3.xsl, line 11, column 47)
So am I creating the XalanDOMStrings incorrectly, or is there some
kind of bug here?
N.B. I am using Linux,
--
Colin Paul Adams
Preston Lancashire