I'm trying to replace the last occurrence of '.' character with '/' character in using XSLT (xslt 1.0 xsltproc). How can I do that?
Input.xml
<testng-results>
<suite>
<test>
<class name="system.apps.webdriver.tests.crm.mot.CreateTerritoryProposalTest">
<test-method status="PASS" started-at="2019-02-07T18:24:47Z" name="initTest">
</test-method>
<test-method status="FAIL" started-at="2019-02-07T18:24:47Z" name="ActListsForContactShowsContactRelatedTasksTest">
</test-method>
</class>
</test>
</suite>
</testng-results>
Current XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<Suite>
<xsl:for-each select="testng-results/suite/test/class/test-method">
<Test>
<Result_Path> <xsl:value-of select="concat('testngreports/', ../@name, '/', @name)"/> </Result_Path>
</Test>
</xsl:for-each>
</Suite>
</xsl:template>
</xsl:stylesheet>
Expected Result XML:
<?xml version="1.0" encoding="UTF-8"?>
<Suite>
<Test>
<Result_Path>testngreports/system.apps.webdriver.tests.crm.mot/CreateTerritoryProposalTest/initTest</Result_Path>
</Test>
<Test>
<Result_Path>testngreports/system.apps.webdriver.tests.crm.mot/CreateTerritoryProposalTest/ActListsForContactShowsContactRelatedTasksTest</Result_Path>
</Test>
</Suite>
Current Output XML:
<?xml version="1.0" encoding="UTF-8"?>
<Suite>
<Test>
<Result_Path>testngreports/system.apps.webdriver.tests.crm.mot.CreateTerritoryProposalTest/initTest</Result_Path>
</Test>
<Test>
<Result_Path>testngreports/system.apps.webdriver.tests.crm.mot.CreateTerritoryProposalTest/ActListsForContactShowsContactRelatedTasksTest</Result_Path>
</Test>
</Suite>
Summary:
Current Output:
testngreports/system.apps.webdriver.tests.crm.mot.CreateTerritoryProposalTest/initTest
Expected Output:
testngreports/system.apps.webdriver.tests.crm.mot/CreateTerritoryProposalTest/initTest
Last '.' character should be replaced with '/'