Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Namespace issue in xsl:function

843834Oct 1 2009 — edited Oct 5 2009
Hi

My requirement is to generate one xml with different set of parameter.

This is my stylesheet(rule.xsl)

--------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>

 

<xsl:stylesheet version="2.0" 

  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

  xmlns:xs="http://www.w3.org/2001/XMLSchema"

  xmlns:rename="http://www.w3.org/2001/XMLSchema" 

  extension-element-prefixes="sample">

            <xsl:function name="rename:declare">

                                    <xsl:param name="from" />

                                    <xsl:param name="to" />

                                    <xsl:result select="<Rename from= $val1 to=$val2/>"/>

            </xsl:function>

  <xsl:template match="/">  

                        <xsl:value-of select="rename:declare(f1, f2)" />

                        <xsl:value-of select="rename:declare(s1, s2)" />

  </xsl:template>

</xsl:stylesheet>
Input.xml

<?xml-stylesheet type="text/xsl" href="rule.xsl"?>



Expected output



<Rename from="f1" to="f2"/>

<Rename from=" f3" to=" f4"/>



Once I run input.xml through IE browser, I get an error

Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions.

Any help would be highly appreciated.

Thanks

Gunjan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 2 2009
Added on Oct 1 2009
3 comments
478 views