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 2025/03/29 09:21:32 UTC

(xalan-java) branch xalan-j_xslt3.0_mvn updated: committing fix for jira issue XALANJ-2804

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xalan-j_xslt3.0_mvn
in repository https://gitbox.apache.org/repos/asf/xalan-java.git


The following commit(s) were added to refs/heads/xalan-j_xslt3.0_mvn by this push:
     new 91ce5efa1 committing fix for jira issue XALANJ-2804
91ce5efa1 is described below

commit 91ce5efa16298d916b7814a25e11f3fe5d241ab2
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sat Mar 29 14:51:15 2025 +0530

    committing fix for jira issue XALANJ-2804
---
 .../java/org/apache/xalan/processor/XSLTSchema.java  | 10 ++++++++--
 .../apache/xalan/templates/ElemAnalyzeString.java    | 20 +++-----------------
 .../apache/xalan/templates/ElemResultDocument.java   | 16 ++++++++--------
 3 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/src/main/java/org/apache/xalan/processor/XSLTSchema.java b/src/main/java/org/apache/xalan/processor/XSLTSchema.java
index ddf817a32..ac11dd310 100644
--- a/src/main/java/org/apache/xalan/processor/XSLTSchema.java
+++ b/src/main/java/org/apache/xalan/processor/XSLTSchema.java
@@ -98,10 +98,16 @@ public class XSLTSchema extends XSLTElementDef
    */
   void build()
   {
-	// xsl:import, xsl:include, xsl:source-document, xsl:result-document
+	// xsl:import, xsl:include, xsl:source-document
     XSLTAttributeDef hrefAttr = new XSLTAttributeDef(null, "href",
                                   XSLTAttributeDef.T_URL, true, false, XSLTAttributeDef.ERROR);
     
+    // Required.
+    // Support AVT
+    // xsl:result-document                  
+    XSLTAttributeDef hrefAVTRequired = new XSLTAttributeDef(null, "href",
+                                         XSLTAttributeDef.T_AVT, true, true, XSLTAttributeDef.WARNING);
+    
     // xsl:import-schema
     XSLTAttributeDef namespaceAttr = new XSLTAttributeDef(null, "namespace",
                                   XSLTAttributeDef.T_URL, false, false, XSLTAttributeDef.ERROR);
@@ -592,7 +598,7 @@ public class XSLTSchema extends XSLTElementDef
     XSLTElementDef xslResultDocument = new XSLTElementDef(this,
 								             Constants.S_XSLNAMESPACEURL, "result-document",
 								             null /*alias */, templateElements,
-								             new XSLTAttributeDef[]{ hrefAttr, methodAttr, 
+								             new XSLTAttributeDef[]{ hrefAVTRequired, methodAttr, 
 								            		                 omitXmlDeclarationAttr, spaceAttr }, 
 								             new ProcessorTemplateElem(),
 								             ElemResultDocument.class /* class object */, true, false, true, 20, true);
diff --git a/src/main/java/org/apache/xalan/templates/ElemAnalyzeString.java b/src/main/java/org/apache/xalan/templates/ElemAnalyzeString.java
index 139406f5c..2a2c4d2fb 100644
--- a/src/main/java/org/apache/xalan/templates/ElemAnalyzeString.java
+++ b/src/main/java/org/apache/xalan/templates/ElemAnalyzeString.java
@@ -33,24 +33,10 @@ import org.apache.xpath.objects.XObject;
 import org.apache.xpath.regex.Matcher;
 
 /**
- * XSLT 3.0 analyze-string element.
+ * Implementation of the XSLT 3.0 xsl:analyze-string instruction.
  * 
- * <xsl:analyze-string
-            select = expression
-            regex = { string }
-            flags? = { string } >
-       <!-- Content: (xsl:matching-substring?, xsl:non-matching-substring?, xsl:fallback*) -->
-   </xsl:analyze-string>
-   
-   <xsl:matching-substring>
-      <!-- Content: sequence-constructor -->
-   </xsl:matching-substring>
-   
-   <xsl:non-matching-substring>
-      <!-- Content: sequence-constructor -->
-   </xsl:non-matching-substring>
-   
- *  
+ * Ref : https://www.w3.org/TR/xslt-30/#analyze-string
+ *   
  * @author Mukul Gandhi <mu...@apache.org>
  * 
  * @xsl.usage advanced
diff --git a/src/main/java/org/apache/xalan/templates/ElemResultDocument.java b/src/main/java/org/apache/xalan/templates/ElemResultDocument.java
index de5c044d4..525842841 100644
--- a/src/main/java/org/apache/xalan/templates/ElemResultDocument.java
+++ b/src/main/java/org/apache/xalan/templates/ElemResultDocument.java
@@ -60,7 +60,7 @@ public class ElemResultDocument extends ElemTemplateElement
   /**
    * The "href" string value.
    */
-  private String m_href = null;
+  private AVT m_href = null;
   
   /**
    * The "method" attribute's value.
@@ -80,9 +80,9 @@ public class ElemResultDocument extends ElemTemplateElement
   /**
    * Get the value of "href" attribute.
    *
-   * @return 	String value for the "href" attribute.
+   * @return 	avt value for the "href" attribute.
    */
-  public String getHref()
+  public AVT getHref()
   {
       return m_href;
   }
@@ -90,9 +90,9 @@ public class ElemResultDocument extends ElemTemplateElement
   /**
    * Set the value of "href" attribute.
    *
-   * @param href	String value for the "href" attribute.
+   * @param href	avt value for the "href" attribute.
    */
-  public void setHref(String href)
+  public void setHref(AVT href)
   {
       this.m_href = href;  
   }
@@ -198,9 +198,9 @@ public class ElemResultDocument extends ElemTemplateElement
 	    		transformer.getTraceManager().emitTraceEvent(this);
 	    	}
 	    	
-	    	String hrefStr = m_href;   			// Mandatory	    	
-	    	QName methodQname = m_method;		// Optional, with default value "xml" 	    	
-	    	boolean omitXmlDeclarationAttr = m_omitXmlDeclaration;   // Optional, with default value "false"
+	    	String hrefStr = m_href.evaluate(xctxt, xctxt.getContextNode(), this);		// Mandatory	    	
+	    	QName methodQname = m_method;												// Optional, with default value "xml"	    	
+	    	boolean omitXmlDeclarationAttr = m_omitXmlDeclaration;   					// Optional, with default value "false"
 	    	
 	    	if ((methodQname == null) || ((Constants.ATTRVAL_OUTPUT_METHOD_XML).equals(methodQname.toString()))) {
 	    		int xdmNodeHandle = transformer.transformToRTF(this);


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