DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18351>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18351 strange behaviour with xsl:choose embedded in func:function Summary: strange behaviour with xsl:choose embedded in func:function Product: XalanJ2 Version: 2.5Dx Platform: Macintosh OS/Version: MacOS X Status: NEW Severity: Normal Priority: Other Component: org.apache.xalan.extensions AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I'm trying to transform this <?xml version="1.0" encoding="utf-8"?> <DatabaseSchema> <Table Type="A" Name="Foo"/> <Table Type="B" Name="Bar"/> <Table Type="A" Name="FooBar"/> <Table Type="B" Name="BarFoo"/> </DatabaseSchema> with the following stylesheet <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xslt" xmlns:redirect="http://xml.apache.org/xalan/redirect" xmlns:func="http://exslt.org/functions" xmlns:my="urn:my" extension-element-prefixes="redirect func" exclude-result-prefixes="my"> <xsl:output method="html" indent="yes" encoding="utf-8" xalan:indent-amount="2"/> <func:function name="my:test"> <xsl:param name="table"/> <xsl:param name="type"/> <xsl:choose> <xsl:when test="$type='B'"> <func:result select="2"/> </xsl:when> <xsl:when test="$type='A'"> <func:result select="1"/> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> Error </xsl:message> </xsl:otherwise> </xsl:choose> </func:function> <xsl:template match="Table"> <xsl:value-of select="my:test(@Name, @Type)"/> </xsl:template> <xsl:template match="/"> <xsl:apply-templates select="DatabaseSchema/Table"/> </xsl:template> </xsl:stylesheet> Trying to transform this, I get the following error: file:///Users/simon/Documents/LEDA/workspace/Data%20Entry%20Tool/src/de/ol/offis/leda/data/test.xsl; Zeile #22; Spalte #17; XSLT-Fehler (javax.xml.transform.TransformerConfigurationException): javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: misplaced literal result in a func:function container. (line 22, col. 17 is right behind /func:function) The transformation doesn't yield an exception if I leave the xsl:otherwise element out, however, the output is 22 instead of the output to expect: 1212 However, if I use xsl:if elements instead of the xsl:choose, as in <func:function name="my:test"> <xsl:param name="table"/> <xsl:param name="type"/> <xsl:if test="$type='B'"> <func:result select="2"/> </xsl:if> <xsl:if test="$type='A'"> <func:result select="1"/> </xsl:if> </func:function> I get the following error: file:///Users/simon/Documents/LEDA/workspace/Data%20Entry%20Tool/src/de/ol/offis/leda/data/test.xsl; Zeile #12; Spalte #28; XSLT-Fehler (javax.xml.transform.TransformerException): Unbekannter Fehler in XPath. (meaning: Unknown error in XPath) Line 12, column 28 is at the end of the line containing the second <xsl:if Using: Xalan-J 2.5D1 Xerces-J 2.3.0 Java 2 SDK 1.4.1_01
