Martin Honnen created XALANJ-2763:
-------------------------------------

             Summary: fn:replace not working correctly
                 Key: XALANJ-2763
                 URL: https://issues.apache.org/jira/browse/XALANJ-2763
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in 
Xalan projects.  Anybody can view the issue.)
          Components: Xalan, Xalan-CmdLine, XPath, XPath-function
    Affects Versions: The Latest Development Code
            Reporter: Martin Honnen
         Attachments: replace-test1.xsl

This is a bug report on the XSLT 3.0 development branch of Xalan.

While the XPath 3.1 function `fn:replace` is implemented, I find that it 
doesn't work correctly with some arguments.

Test case:
{code:java}
<xsl:stylesheet 
  version="3.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xs="http://www.w3.org/2001/XMLSchema";
  exclude-result-prefixes="xs">
  
  <xsl:output indent="no"/>
  
  <xsl:template match="/">
    <xsl:copy>
      <test>
        <xsl:value-of select="replace('  foo  ', ' +', string-join((1 to 4)!' 
', ''))"/>
      </test>
    </xsl:copy>
  </xsl:template>
  
</xsl:stylesheet>{code}
Run against any sample input XML document and the output is e.g.
{code:java}
<?xml version="1.0" encoding="UTF-8"?><test>foo</test>{code}
while it should be e.g.
{code:java}
<?xml version="1.0" encoding="UTF-8"?><test>    foo    </test>{code}
 

So somehow the space matching/replacement is not working.

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to