You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Paul Prescod <pa...@prescod.net> on 2004/02/29 21:25:02 UTC
Function parameters problem
Can anyone recommend a workaround for this problem involving parameters
to func:func functions?
I find it near unbearable to work with string lists in XSLT with
functions and node-sets.
Thanks in advance!
$ ./xbug
xalan-bug.xsl; Line #26; Column #89; XSLT Error
(javax.xml.transform.TransformerException): Variable accessed before it
is bound!
$ cat ./xbug
java -Xbootclasspath/p:xalan-j_2_5_2/bin/xalan.jar
-Xbootclasspath/p:xalan-j_2_5_2/bin/xercesImpl.jar
-Xbootclasspath/p:xalan-j_2_5_2/bin/xml-apis.jar
org.apache.xalan.xslt.Process -XSL xalan-bug.xsl -IN xalan-bug.xsl -OUT
junk.html
$ cat xalan-bug.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:func="http://exslt.org/functions"
extension-element-prefixes="func"
xmlns:my="http://www.prescod.net/xslt/functions"
xmlns:xalan="http://xml.apache.org/xalan"
version="1.0">
<xsl:template name="wrapStringInElement">
<xsl:param name="status-list"/>
<xsl:message><xsl:value-of select="$status-list"/></xsl:message>
</xsl:template>
<func:function name="my:stringToNode">
<xsl:param name="statusList"/>
<xsl:variable name="dummy">
<xsl:call-template name="wrapStringInElement">
<!-- This next line fails: -->
<xsl:with-param name="status-list" select="$statusList"/>
</xsl:call-template>
</xsl:variable>
<func:result select="'blah'"/>
</func:function>
<xsl:template match="/">
<xsl:variable name="string-as-element"
select="my:stringToNode('a b c d e f')"/>
</xsl:template>
</xsl:stylesheet>
Paul Prescod