You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/10/02 01:25:40 UTC
[xalan-java] branch xalan-j_xslt3.0 updated: committing improvements to implementation of xslt 3.0 xsl:function instruction, along with few new working related test cases.
This is an automated email from the ASF dual-hosted git repository.
mukulg pushed a commit to branch xalan-j_xslt3.0
in repository https://gitbox.apache.org/repos/asf/xalan-java.git
The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
new 4b19c1a0 committing improvements to implementation of xslt 3.0 xsl:function instruction, along with few new working related test cases.
new d6bcb2d3 Merge pull request #94 from mukulga/xalan-j_xslt3.0_mukul
4b19c1a0 is described below
commit 4b19c1a0462979dd4e80d4b9131916ac183fa7d0
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Mon Oct 2 06:51:00 2023 +0530
committing improvements to implementation of xslt 3.0 xsl:function instruction, along with few new working related test cases.
---
src/org/apache/xalan/res/XSLTErrorResources.java | 5 ++
src/org/apache/xalan/templates/ElemFunction.java | 71 ++++++++--------------
src/org/apache/xalan/templates/TemplateList.java | 25 +++++---
tests/org/apache/xalan/xslt3/XslFunctionTests.java | 50 +++++++++++++++
tests/xsl_function/gold/test11.out | 4 ++
tests/xsl_function/gold/test12.out | 1 +
tests/xsl_function/gold/test13.out | 1 +
tests/xsl_function/gold/test14.out | 4 ++
tests/xsl_function/gold/test15.out | 4 ++
tests/xsl_function/test11.xsl | 52 ++++++++++++++++
tests/xsl_function/test12.xsl | 50 +++++++++++++++
tests/xsl_function/test13.xsl | 55 +++++++++++++++++
tests/xsl_function/test14.xsl | 60 ++++++++++++++++++
tests/xsl_function/test15.xsl | 62 +++++++++++++++++++
tests/xsl_function/test1_c.xml | 4 ++
15 files changed, 395 insertions(+), 53 deletions(-)
diff --git a/src/org/apache/xalan/res/XSLTErrorResources.java b/src/org/apache/xalan/res/XSLTErrorResources.java
index e71f2b1a..e3737dcc 100644
--- a/src/org/apache/xalan/res/XSLTErrorResources.java
+++ b/src/org/apache/xalan/res/XSLTErrorResources.java
@@ -244,6 +244,8 @@ public class XSLTErrorResources extends ListResourceBundle
"ER_IN_ELEMTEMPLATEELEM_READOBJECT";
public static final String ER_DUPLICATE_NAMED_TEMPLATE =
"ER_DUPLICATE_NAMED_TEMPLATE";
+ public static final String ER_DUPLICATE_XSL_FUNCTION =
+ "ER_DUPLICATE_XSL_FUNCTION";
public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL";
public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF";
public static final String ER_ILLEGAL_DOMSOURCE_INPUT =
@@ -795,6 +797,9 @@ public class XSLTErrorResources extends ListResourceBundle
{ ER_DUPLICATE_NAMED_TEMPLATE,
"Found more than one template named: {0}"},
+
+ { ER_DUPLICATE_XSL_FUNCTION,
+ "Found more than one stylesheet function named: {0}"},
{ ER_INVALID_KEY_CALL,
"Invalid function call: recursive key() calls are not allowed"},
diff --git a/src/org/apache/xalan/templates/ElemFunction.java b/src/org/apache/xalan/templates/ElemFunction.java
index 6c7397b2..cb5bf133 100644
--- a/src/org/apache/xalan/templates/ElemFunction.java
+++ b/src/org/apache/xalan/templates/ElemFunction.java
@@ -64,6 +64,11 @@ public class ElemFunction extends ElemTemplate
{
private static final long serialVersionUID = 4973132678982467288L;
+
+ /**
+ * The value of the "name" attribute.
+ */
+ private static QName m_name;
/**
* Class constructor.
@@ -71,18 +76,22 @@ public class ElemFunction extends ElemTemplate
public ElemFunction() {}
/**
- * The value of the "name" attribute.
+ * Set the value of xsl:function's "name"
+ * attribute.
*/
- protected static QName m_qname;
-
public void setName(QName qName)
- {
- m_qname = qName;
+ {
+ super.setName(qName);
+ m_name = qName;
}
+ /**
+ * Get the value of xsl:function's "name"
+ * attribute.
+ */
public QName getName()
{
- return m_qname;
+ return super.getName();
}
/**
@@ -106,19 +115,6 @@ public class ElemFunction extends ElemTemplate
{
return Constants.ELEMNAME_FUNCTION_STRING;
}
-
- /**
- * The stack frame size for this xsl:function definition, which is equal
- * to the maximum number of params and variables that can be declared
- * in the function at one time.
- */
- public int m_frameSize;
-
- /**
- * The size of the portion of the stack frame that can hold parameter
- * arguments.
- */
- int m_inArgsSize;
/**
* This method evaluates the xsl:function call, and returns the result
@@ -139,8 +135,8 @@ public class ElemFunction extends ElemTemplate
varStack.setStackFrame(thisframe);
- String funcLocalName = m_qname.getLocalName();
- String funcNameSpaceUri = m_qname.getNamespaceURI();
+ String funcLocalName = m_name.getLocalName();
+ String funcNameSpaceUri = m_name.getNamespaceURI();
int paramCount = 0;
for (ElemTemplateElement elem = getFirstChildElem(); elem != null;
@@ -230,17 +226,13 @@ public class ElemFunction extends ElemTemplate
/**
* This function is called after everything else has been
- * recomposed, and allows an xsl:function to set remaining
+ * recomposed, and allows a xsl:function to set remaining
* values that may be based on some other property that
* depends on recomposition.
*/
public void compose(StylesheetRoot sroot) throws TransformerException
{
super.compose(sroot);
- StylesheetRoot.ComposeState cstate = sroot.getComposeState();
- java.util.Vector vnames = cstate.getVariableNames();
- cstate.resetStackFrameSize();
- m_inArgsSize = 0;
}
/**
@@ -250,32 +242,23 @@ public class ElemFunction extends ElemTemplate
*/
public void endCompose(StylesheetRoot sroot) throws TransformerException
{
- StylesheetRoot.ComposeState cstate = sroot.getComposeState();
super.endCompose(sroot);
- m_frameSize = cstate.getFrameSize();
-
- cstate.resetStackFrameSize();
}
/**
- * Set the parent as an ElemTemplateElement.
- *
- * @param p This node's parent as an ElemTemplateElement
+ * This function is called during recomposition to
+ * control how this element is composed.
+ *
+ * @param root The root stylesheet for this transformation.
*/
- public void setParentElem(ElemTemplateElement p)
- {
- super.setParentElem(p);
- p.m_hasVariableDecl = true;
- }
-
public void recompose(StylesheetRoot root)
{
- root.recomposeTemplates(this);
+ super.recompose(root);
}
/**
- * This method helps us solve, XSLT's xsl:function and xsl:variable instruction use cases,
- * where the XSL child contents of xsl:function or xsl:variable instructions contain
+ * This method helps us solve, xsl:function and xsl:variable instruction use cases,
+ * when the XSL child contents of xsl:function or xsl:variable instructions contain
* xsl:sequence instruction(s).
*
* Given an initial result of computation of, XSL child contents of a xsl:function or xsl:variable
@@ -336,8 +319,8 @@ public class ElemFunction extends ElemTemplate
SequenceTypeSupport.OccurenceIndicator.ZERO_OR_ONE)) {
if ((resultSequence != null) && (resultSequence.size() > 1)) {
String errMesg = null;
- if (m_qname != null) {
- errMesg = "XTTE0780 : A sequence of more than one item, is not allowed as a result of call to function '" + m_qname.toString() + "'. "
+ if (m_name != null) {
+ errMesg = "XTTE0780 : A sequence of more than one item, is not allowed as a result of call to function '" + m_name.toString() + "'. "
+ "The expected result type of this function is " + sequenceTypeXPathExprStr + ".";
}
else {
diff --git a/src/org/apache/xalan/templates/TemplateList.java b/src/org/apache/xalan/templates/TemplateList.java
index 5d3da814..5816f15f 100644
--- a/src/org/apache/xalan/templates/TemplateList.java
+++ b/src/org/apache/xalan/templates/TemplateList.java
@@ -66,9 +66,11 @@ public class TemplateList implements java.io.Serializable
XPath matchXPath = template.getMatch();
if (null == template.getName() && null == matchXPath)
- {
- template.error(XSLTErrorResources.ER_NEED_NAME_OR_MATCH_ATTRIB,
- new Object[]{ "xsl:template" });
+ {
+ if (!(template instanceof ElemFunction)) {
+ template.error(XSLTErrorResources.ER_NEED_NAME_OR_MATCH_ATTRIB,
+ new Object[]{ "xsl:template" });
+ }
}
if (null != template.getName())
@@ -88,13 +90,18 @@ public class TemplateList implements java.io.Serializable
// This should never happen
m_namedTemplates.put(template.getName(), template);
}
- else if (newPrecedence == existingPrecedence)
- template.error(XSLTErrorResources.ER_DUPLICATE_NAMED_TEMPLATE,
- new Object[]{ template.getName() });
+ else if (newPrecedence == existingPrecedence) {
+ if (template instanceof ElemFunction) {
+ template.error(XSLTErrorResources.ER_DUPLICATE_XSL_FUNCTION,
+ new Object[]{ template.getName() });
+ }
+ else {
+ template.error(XSLTErrorResources.ER_DUPLICATE_NAMED_TEMPLATE,
+ new Object[]{ template.getName() });
+ }
+ }
}
- }
-
-
+ }
if (null != matchXPath)
{
diff --git a/tests/org/apache/xalan/xslt3/XslFunctionTests.java b/tests/org/apache/xalan/xslt3/XslFunctionTests.java
index b0e8fe65..c6d6bfdc 100644
--- a/tests/org/apache/xalan/xslt3/XslFunctionTests.java
+++ b/tests/org/apache/xalan/xslt3/XslFunctionTests.java
@@ -147,5 +147,55 @@ public class XslFunctionTests extends XslTransformTestsUtil {
runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
}
+
+ @Test
+ public void xslFunctionTest11() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test11.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test11.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslFunctionTest12() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test12.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test12.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslFunctionTest13() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test13.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test13.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test13.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslFunctionTest14() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test14.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslFunctionTest15() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test15.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
}
diff --git a/tests/xsl_function/gold/test11.out b/tests/xsl_function/gold/test11.out
new file mode 100644
index 00000000..e38929f2
--- /dev/null
+++ b/tests/xsl_function/gold/test11.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <one>5</one>
+ <two>7</two>
+</result>
diff --git a/tests/xsl_function/gold/test12.out b/tests/xsl_function/gold/test12.out
new file mode 100644
index 00000000..68eee18c
--- /dev/null
+++ b/tests/xsl_function/gold/test12.out
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><result>10</result>
diff --git a/tests/xsl_function/gold/test13.out b/tests/xsl_function/gold/test13.out
new file mode 100644
index 00000000..6116fb98
--- /dev/null
+++ b/tests/xsl_function/gold/test13.out
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><result>12</result>
diff --git a/tests/xsl_function/gold/test14.out b/tests/xsl_function/gold/test14.out
new file mode 100644
index 00000000..d7a57e84
--- /dev/null
+++ b/tests/xsl_function/gold/test14.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <one>64</one>
+ <two>16.81</two>
+</result>
diff --git a/tests/xsl_function/gold/test15.out b/tests/xsl_function/gold/test15.out
new file mode 100644
index 00000000..d7a57e84
--- /dev/null
+++ b/tests/xsl_function/gold/test15.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <one>64</one>
+ <two>16.81</two>
+</result>
diff --git a/tests/xsl_function/test11.xsl b/tests/xsl_function/test11.xsl
new file mode 100644
index 00000000..b72e246c
--- /dev/null
+++ b/tests/xsl_function/test11.xsl
@@ -0,0 +1,52 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn0="http://fn0"
+ exclude-result-prefixes="xs fn0"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet test case, to test xsl:function instruction.
+ We've more than one function definition within this
+ stylesheet. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <one>
+ <xsl:value-of select="fn0:f1()"/>
+ </one>
+ <two>
+ <xsl:value-of select="fn0:f2()"/>
+ </two>
+ </result>
+ </xsl:template>
+
+ <xsl:function name="fn0:f1" as="xs:integer">
+ <xsl:sequence select="5"/>
+ </xsl:function>
+
+ <xsl:function name="fn0:f2" as="xs:integer">
+ <xsl:sequence select="7"/>
+ </xsl:function>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xsl_function/test12.xsl b/tests/xsl_function/test12.xsl
new file mode 100644
index 00000000..b43ce1ce
--- /dev/null
+++ b/tests/xsl_function/test12.xsl
@@ -0,0 +1,50 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn0="http://fn0"
+ exclude-result-prefixes="xs fn0"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet test case, to test xsl:function instruction.
+ We've more than one function definition within this
+ stylesheet. Within this stylesheet example, the function calls
+ are chained.
+ -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <xsl:value-of select="fn0:f1()"/>
+ </result>
+ </xsl:template>
+
+ <!-- This stylesheet function, calls another stylesheet function. -->
+ <xsl:function name="fn0:f1" as="xs:integer">
+ <xsl:sequence select="fn0:f2()"/>
+ </xsl:function>
+
+ <xsl:function name="fn0:f2" as="xs:integer">
+ <xsl:sequence select="10"/>
+ </xsl:function>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xsl_function/test13.xsl b/tests/xsl_function/test13.xsl
new file mode 100644
index 00000000..5f555253
--- /dev/null
+++ b/tests/xsl_function/test13.xsl
@@ -0,0 +1,55 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn0="http://fn0"
+ exclude-result-prefixes="xs fn0"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet test case, to test xsl:function instruction.
+ We've more than one function definition within this
+ stylesheet. Within this stylesheet example, the function calls
+ are chained.
+ -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <xsl:value-of select="fn0:f1()"/>
+ </result>
+ </xsl:template>
+
+ <!-- This stylesheet function, calls another stylesheet function. -->
+ <xsl:function name="fn0:f1" as="xs:integer">
+ <xsl:sequence select="fn0:f2()"/>
+ </xsl:function>
+
+ <!-- This stylesheet function, calls another stylesheet function. -->
+ <xsl:function name="fn0:f2" as="xs:integer">
+ <xsl:sequence select="fn0:f3()"/>
+ </xsl:function>
+
+ <xsl:function name="fn0:f3" as="xs:integer">
+ <xsl:sequence select="12"/>
+ </xsl:function>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xsl_function/test14.xsl b/tests/xsl_function/test14.xsl
new file mode 100644
index 00000000..305c1296
--- /dev/null
+++ b/tests/xsl_function/test14.xsl
@@ -0,0 +1,60 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn0="http://fn0"
+ exclude-result-prefixes="xs fn0"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet test case, to test xsl:function instruction.
+ We've more than one function definition within this
+ stylesheet. Within this stylesheet example, the function calls
+ are chained.
+ -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <one>
+ <xsl:value-of select="fn0:f1(7)"/>
+ </one>
+ <two>
+ <xsl:value-of select="fn0:f1(3.1)"/>
+ </two>
+ </result>
+ </xsl:template>
+
+ <!-- This stylesheet function, calls the function fn0:sqr. -->
+ <xsl:function name="fn0:f1" as="xs:double">
+ <xsl:param name="a" as="xs:double"/>
+ <xsl:sequence select="fn0:sqr($a + 1)"/>
+ </xsl:function>
+
+ <!-- A stylesheet function, calculating the square
+ of a xs:double value.
+ -->
+ <xsl:function name="fn0:sqr" as="xs:double">
+ <xsl:param name="a" as="xs:double"/>
+ <xsl:sequence select="$a * $a"/>
+ </xsl:function>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xsl_function/test15.xsl b/tests/xsl_function/test15.xsl
new file mode 100644
index 00000000..2a009f69
--- /dev/null
+++ b/tests/xsl_function/test15.xsl
@@ -0,0 +1,62 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn0="http://fn0"
+ exclude-result-prefixes="xs fn0"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_c.xml -->
+
+ <!-- An XSLT stylesheet test case, to test xsl:function instruction.
+ We've more than one function definition within this
+ stylesheet. Within this stylesheet example, the function calls
+ are chained.
+ -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/info">
+ <result>
+ <one>
+ <xsl:value-of select="fn0:f1(num[1])"/>
+ </one>
+ <two>
+ <xsl:value-of select="fn0:f1(num[2])"/>
+ </two>
+ </result>
+ </xsl:template>
+
+ <!-- This stylesheet function, calls the function fn0:sqr. -->
+ <xsl:function name="fn0:f1" as="xs:double">
+ <xsl:param name="a" as="xs:double"/>
+ <xsl:sequence select="fn0:sqr($a + 1)"/>
+ </xsl:function>
+
+ <!-- A stylesheet function, calculating the square
+ of a xs:double value.
+ -->
+ <xsl:function name="fn0:sqr" as="xs:double">
+ <xsl:param name="a" as="xs:double"/>
+ <xsl:sequence select="$a * $a"/>
+ </xsl:function>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xsl_function/test1_c.xml b/tests/xsl_function/test1_c.xml
new file mode 100644
index 00000000..dc4070b9
--- /dev/null
+++ b/tests/xsl_function/test1_c.xml
@@ -0,0 +1,4 @@
+<info>
+ <num>7</num>
+ <num>3.1</num>
+</info>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org