i'm trying with XSLT to update an existing node (ItemDescription) with the concatenation of InternalID(in deeper level) and the existing description.
Origin XML
<urn:ExternalReqForApprovalImportRequest xmlns:urn="urn:Ariba:Buyer:vrealm_1" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" partition="" variant="">
<urn:ExternalReqForApprovalInput_Item>
<urn:item>
<urn:Name>Line 1</urn:Name>
<urn:Operation>NEW</urn:Operation>
<urn:ExternalReqLineItems>
<urn:item>
<urn:ExternalLineNumber>2</urn:ExternalLineNumber>
<urn:ItemDescription>TEST DESCRIPTION 1</urn:ItemDescription>
<urn:Quantity>1.00</urn:Quantity>
<urn:LineExtrinsics>
<Extrinsics>
<Extrinsic name="InternalID">7000083</Extrinsic>
</Extrinsics>
</urn:LineExtrinsics>
</urn:item>
</urn:ExternalReqLineItems>
</urn:item>
<urn:item>
<urn:Name>Line 2</urn:Name>
<urn:Operation>NEW</urn:Operation>
<urn:ExternalReqLineItems>
<urn:item>
<urn:ExternalLineNumber>2</urn:ExternalLineNumber>
<urn:ItemDescription>TEST DESCRIPTION 2</urn:ItemDescription>
<urn:Quantity>1.00</urn:Quantity>
<urn:LineExtrinsics>
<Extrinsics>
<Extrinsic name="InternalID">7000084</Extrinsic>
</Extrinsics>
</urn:LineExtrinsics>
</urn:item>
</urn:ExternalReqLineItems>
</urn:item>
</urn:ExternalReqForApprovalInput_Item>
</urn:ExternalReqForApprovalImportRequest>
The result should be something like this:
<urn:ExternalReqForApprovalImportRequest xmlns:urn="urn:Ariba:Buyer:vrealm_1" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" partition="" variant="">
<urn:ExternalReqForApprovalInput_Item>
<urn:item>
<urn:Name>Line 1</urn:Name>
<urn:Operation>NEW</urn:Operation>
<urn:ExternalReqLineItems>
<urn:item>
<urn:ExternalLineNumber>2</urn:ExternalLineNumber>
<urn:ItemDescription>7000083|TEST DESCRIPTION 1</urn:ItemDescription>
<urn:Quantity>1.00</urn:Quantity>
<urn:LineExtrinsics>
</urn:LineExtrinsics>
</urn:item>
</urn:ExternalReqLineItems>
</urn:item>
<urn:item>
<urn:Name>Line 2</urn:Name>
<urn:Operation>NEW</urn:Operation>
<urn:ExternalReqLineItems>
<urn:item>
<urn:ExternalLineNumber>2</urn:ExternalLineNumber>
<urn:ItemDescription>7000084|TEST DESCRIPTION 2</urn:ItemDescription>
<urn:Quantity>1.00</urn:Quantity>
<urn:LineExtrinsics>
</urn:LineExtrinsics>
</urn:item>
</urn:ExternalReqLineItems>
</urn:item>
</urn:ExternalReqForApprovalInput_Item>
</urn:ExternalReqForApprovalImportRequest>
Im using the XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p1="urn:Ariba:Buyer:vrealm_1">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
But I'm missing how to go to ItemDescription and concatenate the values, what should be the way?
Thank you.
question from:
https://stackoverflow.com/questions/65924846/update-an-existing-node-concatenating-the-iddeeper-level-before-that-value-in 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…