on 04-03-2012 11:23 AM
Hi Experts,
i am using xsl:stylesheet version="1.0"
I have created a user defined "my:func" with no arguments and calling it .
......................................................................
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://xmlns.opentechnology.org/xslt-extensions/common">
<exsl:function name="my:func">
<exsl:result select="myName" />
</exsl:function>
<xsl:template match="/" xml:space="">
<Name>
<xsl:value-of select="myfunc()"/>
</Name>
</xsl:template>
</xsl:stylesheet>
............................................................
and want as
<Name>
MyName
</Name>
But I am getting following error
"Transformer exception occurred when executing XSLT" .
please help me on this..
thanks and regards
anup banerjee
Hi,
I believe you have at least three fundamental problems with your XSLT Code:
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Greg,
thanks for your reply
when checking altova it shows the following error.
Error in XPath expression
Unknown function - Name and number of arguments do not match any function signature in the static context - 'func'
I am using simple function name no any name space for declaraing function
as..
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://xmlns.opentechnology.org/xslt-extensions/common">
<exsl:function name="func">
<exsl:return select="myName"/>
</exsl:function>
<xsl:template match="/" xml:space="">
<Name>
<xsl:value-of select="func()"/>
</Name>
</xsl:template>
</xsl:stylesheet>
please help me regarding this...
thanks and regards,
Anup banerjee
You can try adding a dummy namespace, like below, maybe this will help:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://xmlns.opentechnology.org/xslt-extensions/common" xmlns:own="http://customfunctions.com/">
<exsl:function name="own:func">
<exsl:return select="myName"/>
</exsl:function>
<xsl:template match="/" xml:space="">
<Name>
<xsl:value-of select="own:func()"/>
</Name>
</xsl:template>
</xsl:stylesheet>
Hope this helps,
Greg
HI anup kumar banerjeem,
If you java class is like:
public static String myFunc (String first, String last)
You should call from XSL like:
<xsl:value-of select ="javamap:myFunc($first, $last)"/>
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mightbe issue with xsl mapping and Just try to check the mapping program in you XML SPY and check working fine / not ?
pls refer below blog:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.