tuxji commented on a change in pull request #373:
URL: https://github.com/apache/incubator-daffodil/pull/373#discussion_r417380010



##########
File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/FNFunctions.scala
##########
@@ -683,26 +683,109 @@ case class FNLocalName1(recipe: CompiledDPath, argType: 
NodeInfo.Kind)
   }
 
   override def run(dstate: DState) {
-    // Save off original state, which is the original
-    // element/node that calls inputValueCalc with fn:local-name
-    //
-    val origState = dstate
+    // Save off original node, which is the original
+    // element/node that calls fn:local-name
+    val savedNode = dstate.currentNode
 
     // Execute the recipe/expression which should
-    // return a node/element whose local-name we want.
-    //
+    // return a node/element whose local-name we want
     recipe.run(dstate)
 
     val localName = dstate.currentElement.name
+    dstate.setCurrentNode(savedNode)
 
     if (localName.contains(":"))
       throw new IllegalArgumentException("fn:local-name failed. " + localName 
+ " is not a valid NCName as it contains ':'.")
 
-    // The original state contains the node/element upon which
-    // fn:local-name was called.  This is where we should set
-    // the value.
-    //
-    origState.setCurrentValue(localName)
+    dstate.setCurrentValue(localName)
+  }
+}
+
+/**
+ * Returns the namespace URI of the name of \$arg as an xs:string
+ * value.
+ *
+ * If the argument is omitted, it defaults to the context item (.).
+ * The behavior of the function if the argument is omitted is
+ * exactly the same as if the context item had been passed as
+ * the argument.
+ *
+ * If the node identified by \$arg is neither an element nor an

Review comment:
       I'll update the comments to remove any mention of attribute nodes since 
you're right, DFDL 1.0 doesn't have attribute nodes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to