Re: func:function and func:result
"Michael Kay" <[email protected]> Mon, 23 Nov 2009 00:27:39 -0000
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <2CEE9FC3D2C9423A82BEA8621FFBB7D6@Sealion> |
> -----Original Message----- > From: Michael Kay [mailto:[email protected]] > Sent: 22 November 2009 10:30 > To: 'Tamer Demirel' > Subject: RE: [exslt] func:function and func:result > > > The EXSLT documentation states: > > It is an error if the instantiation of the template results > in the generation of result nodes. For example a call to > my:func as below is an error. > > <func:function name="my:func"> > <foo /> > </func:function> > > I don't know exactly what this statement is supposed to mean, > or how it has been interpreted by the Xalan implementors, so > I don't know if this is relevant to your problem. You may be > better off asking on a Xalan list. (And when you report that > something "doesn't work", it's always useful to say what > actually happened.) > > Why are you mucking about with this extension, rather than > moving to XSLT 2.0 which does this all much more cleanly? > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Tamer > > Demirel > > Sent: 21 November 2009 16:31 > > To: [email protected] > > Subject: [exslt] func:function and func:result > > > > Hallo, > > > > i am using Xalan 2.7.1 and exslt. > > I habe Problems with func:result. > > > > I want to have as result a part of xslt code. > > > > My Example: > > > > Function: > > <func:function name="my:getElement"> > > <xsl:param name="variableName"/> > > <xsl:param name="variableName_final"/> > > <xsl:param name="elementName"/> > > <xsl:element name="{$elementName}"> > > <xsl:element name="xsl:if"> > > <xsl:attribute > > name="test"><xsl:text>string-length($</xsl:text><xsl:value-of > > select="$variableName"/><xsl:text>)>0</xsl:text></xsl:attribute> > > <xsl:element name="xsl:value-of"> > > <xsl:attribute > > name="select"><xsl:text>$</xsl:text><xsl:value-of > > select="$variableName_final"/></xsl:attribute> > > </xsl:element> > > </xsl:element> > > </xsl:element> > > <func:result/> > > </func:function> > > > > Call of the Function: > > <xsl:value-of > > select="my:getElement('invoic_type','invoic_type_final','INVOI > > C_TYPE')"/> > > > > I get the failure: > > misplaced literal result in a func:function container. > > > > But it works for me. > > > > This doesnt work: > > > > <func:function name="my:getElement"> > > <xsl:param name="variableName"/> > > <xsl:param name="variableName_final"/> > > <xsl:param name="elementName"/> > > <func:result> > > <xsl:element name="{$elementName}"> > > <xsl:element name="xsl:if"> > > <xsl:attribute > > name="test"><xsl:text>string-length($</xsl:text><xsl:value-of > > select="$variableName"/><xsl:text>)>0</xsl:text></xsl:attribute> > > <xsl:element name="xsl:value-of"> > > <xsl:attribute > > name="select"><xsl:text>$</xsl:text><xsl:value-of > > select="$variableName_final"/></xsl:attribute> > > </xsl:element> > > </xsl:element> > > </xsl:element> > > </func:result> > > </func:function> > > > > Do somebody know, what i can do to fix the problem? Maybe older > > version helps? > > Thx, > > Tamer > > > > _______________________________________________ > > exslt mailing list > > [email protected] > > http://www.exslt.org/list