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/12/21 13:05:14 UTC

(xalan-java) branch xalan-j_xslt3.0 updated: committing implementation of xml schema data types xs:normalizedString, xs:token and their use within xalanj's xslt 3.0 processor on dev repos branch xalan-j_xslt3.0

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 7b0b358b committing implementation of xml schema data types xs:normalizedString, xs:token and their use within xalanj's xslt 3.0 processor on dev repos branch xalan-j_xslt3.0
     new 6f01a423 Merge pull request #143 from mukulga/xalan-j_xslt3.0_mukul
7b0b358b is described below

commit 7b0b358bd56559fda63a2b9edde566dc799d65d4
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Thu Dec 21 18:30:50 2023 +0530

    committing implementation of xml schema data types xs:normalizedString, xs:token and their use within xalanj's xslt 3.0 processor on dev repos branch xalan-j_xslt3.0
---
 lib/xpath31_types.jar                              | Bin 47567 -> 50256 bytes
 .../xalan/templates/XSConstructorFunctionUtil.java | 465 +++++++++++----------
 src/org/apache/xpath/compiler/Keywords.java        |   6 +
 src/org/apache/xpath/compiler/XPathParser.java     |   6 +
 .../xpath/composite/SequenceTypeSupport.java       |   4 +
 src/org/apache/xpath/objects/XObject.java          |   6 +
 src/org/apache/xpath/operations/InstanceOf.java    |  13 +
 .../xalan/xpath3/XsConstructorFunctionTests.java   |  31 ++
 tests/org/apache/xalan/xslt3/XSLConstants.java     |   4 +-
 tests/xs_constructor_functions/gold/test23.out     |   4 +
 tests/xs_constructor_functions/gold/test24.out     |   1 +
 tests/xs_constructor_functions/test23.xsl          |  46 ++
 tests/xs_constructor_functions/test24.xsl          |  41 ++
 tests/xs_constructor_functions/test25.xsl          |  36 ++
 14 files changed, 442 insertions(+), 221 deletions(-)

diff --git a/lib/xpath31_types.jar b/lib/xpath31_types.jar
index a64586bb..f0a9c1fe 100644
Binary files a/lib/xpath31_types.jar and b/lib/xpath31_types.jar differ
diff --git a/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java b/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
index 8bc40699..ff864f3b 100644
--- a/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
+++ b/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
@@ -43,8 +43,10 @@ import xml.xpath31.processor.types.XSFloat;
 import xml.xpath31.processor.types.XSInt;
 import xml.xpath31.processor.types.XSInteger;
 import xml.xpath31.processor.types.XSLong;
+import xml.xpath31.processor.types.XSNormalizedString;
 import xml.xpath31.processor.types.XSString;
 import xml.xpath31.processor.types.XSTime;
+import xml.xpath31.processor.types.XSToken;
 import xml.xpath31.processor.types.XSYearMonthDuration;
 
 /**
@@ -79,226 +81,251 @@ public class XSConstructorFunctionUtil {
         
         SourceLocator srcLocator = xctxt.getSAXLocator();
         
-        if (expr instanceof FuncExtFunction) {
-            FuncExtFunction funcExtFunction = (FuncExtFunction)expr;
-            
-            String funcName = funcExtFunction.getFunctionName();
-            String funcNamespace = funcExtFunction.getNamespace();
-            
-            ExpressionNode expressionNode = expr.getExpressionOwner();
-            ExpressionNode stylesheetRootNode = null;
-            while (expressionNode != null) {
-                stylesheetRootNode = expressionNode;
-                expressionNode = expressionNode.exprGetParent();                     
-            }
-            
-            StylesheetRoot stylesheetRoot = (StylesheetRoot)stylesheetRootNode;
-            
-            if (transformer == null) {
-               transformer = stylesheetRoot.getTransformerImpl();  
-            }
-            
-            TemplateList templateList = stylesheetRoot.getTemplateListComposed();
-            
-            ElemTemplate elemTemplate = templateList.getTemplate(new QName(funcNamespace, funcName));
-                        
-            if ((elemTemplate != null) && (elemTemplate instanceof ElemFunction)) {
-                // Handle call to XSLT stylesheet function definition, specified with syntax 
-                // xsl:function.                
-                ResultSequence argSequence = new ResultSequence();
-                for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                    XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                    argSequence.add(argVal);
-                }
-                
-                evalResult = ((ElemFunction)elemTemplate).executeXslFunction(transformer, argSequence);
-            }            
-            else if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(funcExtFunction.getNamespace())) {                
-                // Handle call to XPath 3.1 constructor function, having syntax with form
-                // xs:type_name(..). 
-                ResultSequence argSequence = new ResultSequence();
-                ResultSequence evalResultSequence = null;
-                
-                switch (funcExtFunction.getFunctionName()) {
-                    case Keywords.XS_STRING :                        
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(new XSString(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSString()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;
-                    case Keywords.XS_DECIMAL :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(new XSDecimal(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSDecimal()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;
-                    case Keywords.XS_FLOAT :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(new XSFloat(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSFloat()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;                
-                    case Keywords.XS_DOUBLE :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(new XSDouble(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSDouble()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;                
-                    case Keywords.XS_INTEGER :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(new XSInteger(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSInteger()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;                
-                    case Keywords.XS_LONG :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(new XSLong(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSLong()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;
-                    case Keywords.XS_INT :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(new XSInt(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSInt()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;
-                    case Keywords.FUNC_BOOLEAN_STRING :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            String argStrVal = XslTransformEvaluationHelper.getStrVal(argVal);
-                            Boolean boolVal = Boolean.valueOf(("0".equals(argStrVal) || "false".equals(argStrVal)) ? 
-                                                                                                     "false" : "true");
-                            argSequence.add(new XSBoolean(boolVal));
-                        }
-    
-                        evalResultSequence = (new XSBoolean()).constructor(argSequence);
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;
-                    case Keywords.XS_DATE :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(XSDate.parseDate(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSDate()).constructor(argSequence); 
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;
-                    case Keywords.XS_DATETIME :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            argSequence.add(XSDateTime.parseDateTime(XslTransformEvaluationHelper.getStrVal(argVal)));
-                        }
-    
-                        evalResultSequence = (new XSDateTime()).constructor(argSequence); 
-                        evalResult = evalResultSequence.item(0);
-                        
-                        break;
-                    case Keywords.XS_DURATION :
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
-                            XSDuration xsDuration = XSDuration.parseDuration(strVal);
-                            if (xsDuration != null) {
-                               argSequence.add(xsDuration);
-                               evalResultSequence = (new XSDuration()).constructor(argSequence); 
-                               evalResult = evalResultSequence.item(0);
-                            }
-                            else {
-                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:duration value '" + 
-                                                                                               strVal + "' is present in the input.", srcLocator); 
-                            }
-                        }
-                        
-                        break;
-                    case Keywords.XS_YEAR_MONTH_DURATION :                   
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
-                            XSDuration xsDuration = XSYearMonthDuration.parseYearMonthDuration(strVal);
-                            if (xsDuration != null) {
-                               argSequence.add(xsDuration);
-                               evalResultSequence = (new XSYearMonthDuration()).constructor(argSequence); 
-                               evalResult = evalResultSequence.item(0);
-                            }
-                            else {
-                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:yearMonthDuration value '" + 
-                                                                                                strVal + "' is present in the input.", srcLocator); 
-                            }
-                        }
-                        
-                        break;
-                    case Keywords.XS_DAY_TIME_DURATION :                 
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
-                            XSDuration xsDuration = XSDayTimeDuration.parseDayTimeDuration(strVal);
-                            if (xsDuration != null) {
-                               argSequence.add(xsDuration);
-                               evalResultSequence = (new XSDayTimeDuration()).constructor(argSequence); 
-                               evalResult = evalResultSequence.item(0);
-                            }
-                            else {
-                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:dayTimeDuration value '" + 
-                                                                                                strVal + "' is present in the input.", srcLocator); 
-                            }                            
-                        }
-                        
-                        break;
-                    case Keywords.XS_TIME :                 
-                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
-                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
-                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
-                            XSTime xsTime = XSTime.parseTime(strVal);
-                            if (xsTime != null) {
-                               argSequence.add(xsTime);
-                               evalResultSequence = (new XSTime()).constructor(argSequence); 
-                               evalResult = evalResultSequence.item(0);
-                            }
-                            else {
-                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:time value '" + 
-                                                                                                strVal + "' is present in the input.", srcLocator); 
-                            }                            
-                        }
-                        
-                        break;
-                        
-                    default:
-                       // no op
-                  }
-             }
+        try {        
+	        if (expr instanceof FuncExtFunction) {
+	            FuncExtFunction funcExtFunction = (FuncExtFunction)expr;
+	            
+	            String funcName = funcExtFunction.getFunctionName();
+	            String funcNamespace = funcExtFunction.getNamespace();
+	            
+	            ExpressionNode expressionNode = expr.getExpressionOwner();
+	            ExpressionNode stylesheetRootNode = null;
+	            while (expressionNode != null) {
+	                stylesheetRootNode = expressionNode;
+	                expressionNode = expressionNode.exprGetParent();                     
+	            }
+	            
+	            StylesheetRoot stylesheetRoot = (StylesheetRoot)stylesheetRootNode;
+	            
+	            if (transformer == null) {
+	               transformer = stylesheetRoot.getTransformerImpl();  
+	            }
+	            
+	            TemplateList templateList = stylesheetRoot.getTemplateListComposed();
+	            
+	            ElemTemplate elemTemplate = templateList.getTemplate(new QName(funcNamespace, funcName));
+	                        
+	            if ((elemTemplate != null) && (elemTemplate instanceof ElemFunction)) {
+	                // Handle call to XSLT stylesheet function definition, specified with syntax 
+	                // xsl:function.                
+	                ResultSequence argSequence = new ResultSequence();
+	                for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                    XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                    argSequence.add(argVal);
+	                }
+	                
+	                evalResult = ((ElemFunction)elemTemplate).executeXslFunction(transformer, argSequence);
+	            }            
+	            else if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(funcExtFunction.getNamespace())) {                
+	                // Handle call to XPath 3.1 constructor function, having syntax with form
+	                // xs:type_name(..). 
+	                ResultSequence argSequence = new ResultSequence();
+	                ResultSequence evalResultSequence = null;
+	                
+	                switch (funcExtFunction.getFunctionName()) {
+	                    case Keywords.XS_STRING :                        
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSString(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSString()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_NORMALIZED_STRING :                        
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSNormalizedString(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSNormalizedString()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_TOKEN :                        
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSToken(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSToken()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_DECIMAL :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSDecimal(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSDecimal()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_FLOAT :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSFloat(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSFloat()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;                
+	                    case Keywords.XS_DOUBLE :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSDouble(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSDouble()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;                
+	                    case Keywords.XS_INTEGER :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSInteger(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSInteger()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0); 
+	                        
+	                        break;                
+	                    case Keywords.XS_LONG :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSLong(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSLong()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_INT :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSInt(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSInt()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.FUNC_BOOLEAN_STRING :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            String argStrVal = XslTransformEvaluationHelper.getStrVal(argVal);
+	                            Boolean boolVal = Boolean.valueOf(("0".equals(argStrVal) || "false".equals(argStrVal)) ? 
+	                                                                                                     "false" : "true");
+	                            argSequence.add(new XSBoolean(boolVal));
+	                        }
+	    
+	                        evalResultSequence = (new XSBoolean()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_DATE :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(XSDate.parseDate(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSDate()).constructor(argSequence); 
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_DATETIME :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(XSDateTime.parseDateTime(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSDateTime()).constructor(argSequence); 
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_DURATION :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
+	                            XSDuration xsDuration = XSDuration.parseDuration(strVal);
+	                            if (xsDuration != null) {
+	                               argSequence.add(xsDuration);
+	                               evalResultSequence = (new XSDuration()).constructor(argSequence); 
+	                               evalResult = evalResultSequence.item(0);
+	                            }
+	                            else {
+	                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:duration value '" + 
+	                                                                                               strVal + "' is present in the input.", srcLocator); 
+	                            }
+	                        }
+	                        
+	                        break;
+	                    case Keywords.XS_YEAR_MONTH_DURATION :                   
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
+	                            XSDuration xsDuration = XSYearMonthDuration.parseYearMonthDuration(strVal);
+	                            if (xsDuration != null) {
+	                               argSequence.add(xsDuration);
+	                               evalResultSequence = (new XSYearMonthDuration()).constructor(argSequence); 
+	                               evalResult = evalResultSequence.item(0);
+	                            }
+	                            else {
+	                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:yearMonthDuration value '" + 
+	                                                                                                strVal + "' is present in the input.", srcLocator); 
+	                            }
+	                        }
+	                        
+	                        break;
+	                    case Keywords.XS_DAY_TIME_DURATION :                 
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
+	                            XSDuration xsDuration = XSDayTimeDuration.parseDayTimeDuration(strVal);
+	                            if (xsDuration != null) {
+	                               argSequence.add(xsDuration);
+	                               evalResultSequence = (new XSDayTimeDuration()).constructor(argSequence); 
+	                               evalResult = evalResultSequence.item(0);
+	                            }
+	                            else {
+	                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:dayTimeDuration value '" + 
+	                                                                                                strVal + "' is present in the input.", srcLocator); 
+	                            }                            
+	                        }
+	                        
+	                        break;
+	                    case Keywords.XS_TIME :                 
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            String strVal = XslTransformEvaluationHelper.getStrVal(argVal);
+	                            XSTime xsTime = XSTime.parseTime(strVal);
+	                            if (xsTime != null) {
+	                               argSequence.add(xsTime);
+	                               evalResultSequence = (new XSTime()).constructor(argSequence); 
+	                               evalResult = evalResultSequence.item(0);
+	                            }
+	                            else {
+	                               throw new TransformerException("FORG0001 : An incorrectly formatted xs:time value '" + 
+	                                                                                                         strVal + "' is present in the input.", srcLocator); 
+	                            }                            
+	                        }
+	                        
+	                        break;
+	                        
+	                    default:
+	                       // no op
+	                  }
+	             }
+	        }
+	        else {
+	           evalResult = expr.execute(xctxt);   
+	        }
         }
-        else {
-           evalResult = expr.execute(xctxt);   
+        catch (TransformerException ex) {
+            throw new TransformerException(ex.getMessage(), srcLocator); 
         }
 
         return evalResult;
diff --git a/src/org/apache/xpath/compiler/Keywords.java b/src/org/apache/xpath/compiler/Keywords.java
index 471f925d..a7cb4b29 100644
--- a/src/org/apache/xpath/compiler/Keywords.java
+++ b/src/org/apache/xpath/compiler/Keywords.java
@@ -366,6 +366,12 @@ public class Keywords
   /** xs:string data type string. */
   public static final String XS_STRING = "string";
   
+  /** xs:normalizedString data type string. */
+  public static final String XS_NORMALIZED_STRING = "normalizedString";
+  
+  /** xs:token data type string. */
+  public static final String XS_TOKEN = "token";
+  
   /** xs:decimal data type string. */
   public static final String XS_DECIMAL = "decimal";
   
diff --git a/src/org/apache/xpath/compiler/XPathParser.java b/src/org/apache/xpath/compiler/XPathParser.java
index 9e654cc6..1042f5b9 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -3760,6 +3760,12 @@ public class XPathParser
             case Keywords.XS_STRING :
                xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.STRING);
                break; 
+            case Keywords.XS_NORMALIZED_STRING :
+                xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_NORMALIZED_STRING);
+                break;
+            case Keywords.XS_TOKEN :
+                xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_TOKEN);
+                break;
             case Keywords.XS_DECIMAL :
                xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_DECIMAL);
                break; 
diff --git a/src/org/apache/xpath/composite/SequenceTypeSupport.java b/src/org/apache/xpath/composite/SequenceTypeSupport.java
index e2c65a64..632bc1df 100644
--- a/src/org/apache/xpath/composite/SequenceTypeSupport.java
+++ b/src/org/apache/xpath/composite/SequenceTypeSupport.java
@@ -114,6 +114,10 @@ public class SequenceTypeSupport {
     
     public static int XS_UNTYPED = 17;
     
+    public static int XS_NORMALIZED_STRING = 18;
+    
+    public static int XS_TOKEN = 19;
+    
     /** 
      * Following are constant int values denoting XPath 3.1 sequence
      * type KindTest expressions.
diff --git a/src/org/apache/xpath/objects/XObject.java b/src/org/apache/xpath/objects/XObject.java
index 6015a1ac..3f986deb 100644
--- a/src/org/apache/xpath/objects/XObject.java
+++ b/src/org/apache/xpath/objects/XObject.java
@@ -261,6 +261,12 @@ public class XObject extends Expression implements Serializable, Cloneable
   
   /** Constant for XPath 3.1 xs:float object type */
   public static final int CLASS_XS_FLOAT = 20;
+  
+  /** Constant for XPath 3.1 xs:normalizedString object type */
+  public static final int CLASS_XS_NORMALIZED_STRING = 21;
+  
+  /** Constant for XPath 3.1 xs:token object type */
+  public static final int CLASS_XS_TOKEN = 22;
 
   /** Represents an unresolved variable type as an integer. */
   public static final int CLASS_UNRESOLVEDVARIABLE = 600;
diff --git a/src/org/apache/xpath/operations/InstanceOf.java b/src/org/apache/xpath/operations/InstanceOf.java
index 684cc79e..a0d81f45 100644
--- a/src/org/apache/xpath/operations/InstanceOf.java
+++ b/src/org/apache/xpath/operations/InstanceOf.java
@@ -47,8 +47,10 @@ import xml.xpath31.processor.types.XSFloat;
 import xml.xpath31.processor.types.XSInt;
 import xml.xpath31.processor.types.XSInteger;
 import xml.xpath31.processor.types.XSLong;
+import xml.xpath31.processor.types.XSNormalizedString;
 import xml.xpath31.processor.types.XSString;
 import xml.xpath31.processor.types.XSTime;
+import xml.xpath31.processor.types.XSToken;
 import xml.xpath31.processor.types.XSUntyped;
 import xml.xpath31.processor.types.XSUntypedAtomic;
 import xml.xpath31.processor.types.XSYearMonthDuration;
@@ -113,6 +115,16 @@ public class InstanceOf extends Operation
                                                          (seqTypedData.getItemTypeOccurrenceIndicator() == SequenceTypeSupport.OccurenceIndicator.ZERO_OR_ONE))) {
           isInstanceOf = true;
       }
+      else if ((xdmValue instanceof XSNormalizedString) && (seqTypedData.getSequenceType() == SequenceTypeSupport.XS_NORMALIZED_STRING) && 
+              ((seqTypedData.getItemTypeOccurrenceIndicator() == 0) || 
+                                                         (seqTypedData.getItemTypeOccurrenceIndicator() == SequenceTypeSupport.OccurenceIndicator.ZERO_OR_ONE))) {
+          isInstanceOf = true;
+      }
+      else if ((xdmValue instanceof XSToken) && (seqTypedData.getSequenceType() == SequenceTypeSupport.XS_TOKEN) && 
+              ((seqTypedData.getItemTypeOccurrenceIndicator() == 0) || 
+                                                         (seqTypedData.getItemTypeOccurrenceIndicator() == SequenceTypeSupport.OccurenceIndicator.ZERO_OR_ONE))) {
+          isInstanceOf = true;
+      }
       else if ((xdmValue instanceof XBoolean || xdmValue instanceof XSBoolean) && 
               (seqTypedData.getSequenceType() == SequenceTypeSupport.BOOLEAN) && 
               ((seqTypedData.getItemTypeOccurrenceIndicator() == 0) || 
@@ -312,4 +324,5 @@ public class InstanceOf extends Operation
     
       return isInstanceOf;
   }
+  
 }
diff --git a/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java b/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
index 18605ad5..32cf5907 100644
--- a/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
+++ b/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
@@ -16,6 +16,7 @@
  */
 package org.apache.xalan.xpath3;
 
+import org.apache.xalan.util.XslTestsErrorHandler;
 import org.apache.xalan.util.XslTransformTestsUtil;
 import org.apache.xalan.xslt3.XSLConstants;
 import org.junit.AfterClass;
@@ -267,5 +268,35 @@ public class XsConstructorFunctionTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void XsConstructorFunctionsTest23() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test23.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test23.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test23.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsConstructorFunctionsTest24() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test24.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test24.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test24.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, new XslTestsErrorHandler());
+    }
+    
+    @Test
+    public void XsConstructorFunctionsTest25() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test25.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test25.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test24.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, new XslTestsErrorHandler());
+    }
 
 }
diff --git a/tests/org/apache/xalan/xslt3/XSLConstants.java b/tests/org/apache/xalan/xslt3/XSLConstants.java
index c85a98db..468e4480 100644
--- a/tests/org/apache/xalan/xslt3/XSLConstants.java
+++ b/tests/org/apache/xalan/xslt3/XSLConstants.java
@@ -36,8 +36,8 @@ public class XSLConstants {
     // the values of following, two variables are host specific where this test suite shall be run. the values of
     // following two variables may be modified, accordingly.
     
-    public static final String XSL_TRANSFORM_INPUT_DIRPATH_PREFIX = "file:///d:/eclipseWorkspaces/xalanj/xalan-java/tests/";
+    public static final String XSL_TRANSFORM_INPUT_DIRPATH_PREFIX = "file:///E:/eclipseWorkspace/xalanj/xalan-j_xslt3.0_mukul/tests/";
     
-    public static final String XSL_TRANSFORM_GOLD_DIRPATH_PREFIX = "d:/eclipseWorkspaces/xalanj/xalan-java/tests/";
+    public static final String XSL_TRANSFORM_GOLD_DIRPATH_PREFIX = "E:/eclipseWorkspace/xalanj/xalan-j_xslt3.0_mukul/tests/";
 
 }
diff --git a/tests/xs_constructor_functions/gold/test23.out b/tests/xs_constructor_functions/gold/test23.out
new file mode 100644
index 00000000..ed1f80a2
--- /dev/null
+++ b/tests/xs_constructor_functions/gold/test23.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>true</two>
+</result>
diff --git a/tests/xs_constructor_functions/gold/test24.out b/tests/xs_constructor_functions/gold/test24.out
new file mode 100644
index 00000000..3ea7b254
--- /dev/null
+++ b/tests/xs_constructor_functions/gold/test24.out
@@ -0,0 +1 @@
+<temp/>
\ No newline at end of file
diff --git a/tests/xs_constructor_functions/test23.xsl b/tests/xs_constructor_functions/test23.xsl
new file mode 100644
index 00000000..f15c2b9b
--- /dev/null
+++ b/tests/xs_constructor_functions/test23.xsl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+  <!-- Author: mukulg@apache.org -->
+  
+  <!-- An XSLT stylesheet test case, to test XPath data types 
+       xs:normalizedString, xs:token.  
+  -->                
+                
+  <xsl:output method="xml" indent="yes"/>                
+  
+  <xsl:template match="/">
+     <xsl:variable name="normStr1" select="xs:normalizedString('abcpqr')"/>
+     <xsl:variable name="token1" select="xs:token('abcpqr')"/>
+     <result>
+        <one>
+           <xsl:value-of select="$normStr1 instance of xs:normalizedString"/>
+        </one>
+        <two>
+           <xsl:value-of select="$token1 instance of xs:token"/>
+        </two>
+     </result>
+  </xsl:template>
+  
+  <!--
+      * 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/xs_constructor_functions/test24.xsl b/tests/xs_constructor_functions/test24.xsl
new file mode 100644
index 00000000..66a1614b
--- /dev/null
+++ b/tests/xs_constructor_functions/test24.xsl
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+  <!-- Author: mukulg@apache.org -->
+  
+  <!-- An XSLT stylesheet test case, that tests invalid
+       construction of an XML Schema xs:normalizedString value.
+  -->                
+                
+  <xsl:output method="text"/>
+  
+  <!-- variable referring carriage return character's, hex value -->
+  <xsl:variable name="cr_hex_val" select="'&#x0d;'"/>
+  
+  <xsl:template match="/">
+     <xsl:variable name="normStr1" select="xs:normalizedString('abc' || $cr_hex_val || 'pqr')"/>
+     <xsl:value-of select="$normStr1"/>
+  </xsl:template>
+  
+  <!--
+      * 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/xs_constructor_functions/test25.xsl b/tests/xs_constructor_functions/test25.xsl
new file mode 100644
index 00000000..c00d2363
--- /dev/null
+++ b/tests/xs_constructor_functions/test25.xsl
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+  <!-- An XSLT stylesheet test case, that tests invalid
+       construction of an XML Schema xs:token value.
+  -->                
+                
+  <xsl:output method="text"/>
+  
+  <xsl:template match="/">
+     <xsl:variable name="tokenStr1" select="xs:token('abc  pqr')"/>
+     <xsl:value-of select="$tokenStr1"/>
+  </xsl:template>
+  
+  <!--
+      * 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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org