Example:
Code: Select all
<order>
<jobs>
<job>
<jobID>A</jobID>
<fileName>*/abcdef.pdf</fileName>
</job>
<job>
<jobID>B</jobID>
<fileName>*/abcdef.pdf</fileName>
</job>
</jobs>
</order>
Code: Select all
<order>
<jobs>
<job>
<jobID>A</jobID>
<fileName>*/abcdef.pdf</fileName>
</job>
<job>
<jobID>B</jobID>
<fileName>*/abcdef.pdf</fileName>
</job>
</jobs>
</order>
Code: Select all
<order>
<jobs>
<job>
<jobID>A</jobID>
<fileName>*/abcdef.pdf</fileName>
</job>
<job>
<jobID>B</jobID>
<fileName>*/abcdef.pdf</fileName>
</job>
</jobs>
</order>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Identity template to copy everything as-is -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Match the 'fileName' elements for 'job' elements with jobID 'B' -->
<xsl:template match="job[jobID = 'B']/fileName">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:text>nieuw_something.pdf/</xsl:text>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0"?><order>
<jobs>
<job>
<jobID>A</jobID>
<fileName>*/abcdef.pdf</fileName>
</job>
<job>
<jobID>B</jobID>
<fileName>nieuw_something.pdf/</fileName>
</job>
</jobs>
</order>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Identity template to copy everything as-is -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Match the 'fileName' elements -->
<xsl:template match="fileName">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="concat(substring-before(., concat(../jobID, '\')), ../jobID, '\', ../jobID, '_', substring-after(., concat(../jobID, '\')))"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>