<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: copying Parent XML tag value to child tag value in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348361#M235355</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Are you looking to copy the value from the parent tag name attribute "&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalQTY name=" 5.000"&amp;gt;&lt;/FONT&gt;" to the value of the child tag "&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalORDEREDPURCHASEQUANTITY&amp;gt;&lt;/FONT&gt;" so that its matching all the time? If so you can try the TransformXML processor with the following script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;
&amp;lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"&amp;gt;
 &amp;lt;xsl:template match="@*|node()"&amp;gt;
        &amp;lt;xsl:copy&amp;gt;
            &amp;lt;xsl:apply-templates select="@*|node()"/&amp;gt;
        &amp;lt;/xsl:copy&amp;gt;
    &amp;lt;/xsl:template&amp;gt;
    &amp;lt;xsl:template match="Document/PURCHPURCHASEORDERHEADERV2ENTITY/OriginalQTY/PURCHPURCHASEORDERLINEV2ENTITY/OriginalORDEREDPURCHASEQUANTITY"&amp;gt;
        &amp;lt;xsl:copy&amp;gt;
             &amp;lt;xsl:value-of select="../../@name"/&amp;gt;
        &amp;lt;/xsl:copy&amp;gt;
    &amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:transform&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;If you find that helpful please accept solution. Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2022 20:48:18 GMT</pubDate>
    <dc:creator>SAMSAL</dc:creator>
    <dc:date>2022-07-20T20:48:18Z</dc:date>
    <item>
      <title>copying Parent XML tag value to child tag value</title>
      <link>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348032#M235308</link>
      <description>&lt;P&gt;Hi Team ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Could you please help me in working with XML tag's in Nifi. I've a scenario where i need to look for the parent xml tag value in entire document, the corresponding child xml tag value should match. if it is not matching we should copy the parent xml tag value to the corresponding specified child tag.&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;here the parent tag is&amp;nbsp;&amp;lt;OriginalQTY name=" 5.000"&amp;gt;&amp;nbsp; &amp;nbsp; and the child tag should match is&amp;nbsp;&amp;lt;OriginalORDEREDPURCHASEQUANTITY&amp;gt;&amp;nbsp; &amp;nbsp;So every time&amp;nbsp;&amp;lt;OriginalORDEREDPURCHASEQUANTITY&amp;gt; should match &amp;lt;OriginalQTY&amp;gt; value in name.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;Document&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;PURCHPURCHASEORDERHEADERV2ENTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;VENDORACCOUNT&amp;gt;XXXXX&amp;lt;/VENDORACCOUNT&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;CURRENCYCODE&amp;gt;ZAR&amp;lt;/CURRENCYCODE&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalQTY name=" 1.000"&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;PURCHPURCHASEORDERLINEV2ENTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;PURCHASEORDERNUMBER&amp;gt;PO-XXXXXXX&amp;lt;/PURCHASEORDERNUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;LINENUMBER&amp;gt;0000000100&amp;lt;/LINENUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;PURCHASEPRICE&amp;gt;???&amp;lt;/PURCHASEPRICE&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;ITEMNUMBER&amp;gt;XXXXXXXXX&amp;lt;/ITEMNUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;CONFIRMEDQUANTITY&amp;gt; 0.000&amp;lt;/CONFIRMEDQUANTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalORDEREDPURCHASEQUANTITY&amp;gt; 7.000&amp;lt;/OriginalORDEREDPURCHASEQUANTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;/OriginalQTY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalQTY name=" 5.000"&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;PURCHPURCHASEORDERLINEV2ENTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;PURCHASEORDERNUMBER&amp;gt;PO-XXXXXXXXX&amp;lt;/PURCHASEORDERNUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;LINENUMBER&amp;gt;0000000100&amp;lt;/LINENUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;PURCHASEPRICE&amp;gt;???&amp;lt;/PURCHASEPRICE&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;ITEMNUMBER&amp;gt;A4634101302&amp;lt;/ITEMNUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;CONFIRMEDQUANTITY&amp;gt; 0.000&amp;lt;/CONFIRMEDQUANTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalORDEREDPURCHASEQUANTITY&amp;gt; 7.000&amp;lt;/OriginalORDEREDPURCHASEQUANTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;/OriginalQTY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;/PURCHPURCHASEORDERHEADERV2ENTITY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;/Document&amp;gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 06:21:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348032#M235308</guid>
      <dc:creator>PradNiFi1236</dc:creator>
      <dc:date>2022-07-19T06:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: copying Parent XML tag value to child tag value</title>
      <link>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348091#M235315</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/38301"&gt;@mburgess&lt;/a&gt;&amp;nbsp;Could you please help on this? thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 17:12:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348091#M235315</guid>
      <dc:creator>PradNiFi1236</dc:creator>
      <dc:date>2022-07-19T17:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: copying Parent XML tag value to child tag value</title>
      <link>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348361#M235355</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Are you looking to copy the value from the parent tag name attribute "&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalQTY name=" 5.000"&amp;gt;&lt;/FONT&gt;" to the value of the child tag "&lt;FONT size="1 2 3 4 5 6 7"&gt;&amp;lt;OriginalORDEREDPURCHASEQUANTITY&amp;gt;&lt;/FONT&gt;" so that its matching all the time? If so you can try the TransformXML processor with the following script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;
&amp;lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"&amp;gt;
 &amp;lt;xsl:template match="@*|node()"&amp;gt;
        &amp;lt;xsl:copy&amp;gt;
            &amp;lt;xsl:apply-templates select="@*|node()"/&amp;gt;
        &amp;lt;/xsl:copy&amp;gt;
    &amp;lt;/xsl:template&amp;gt;
    &amp;lt;xsl:template match="Document/PURCHPURCHASEORDERHEADERV2ENTITY/OriginalQTY/PURCHPURCHASEORDERLINEV2ENTITY/OriginalORDEREDPURCHASEQUANTITY"&amp;gt;
        &amp;lt;xsl:copy&amp;gt;
             &amp;lt;xsl:value-of select="../../@name"/&amp;gt;
        &amp;lt;/xsl:copy&amp;gt;
    &amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:transform&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;If you find that helpful please accept solution. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 20:48:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348361#M235355</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2022-07-20T20:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: copying Parent XML tag value to child tag value</title>
      <link>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348438#M235366</link>
      <description>&lt;P&gt;Yes that's the requirement.&lt;/P&gt;&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;, it worked. perfectly, Could you please help me any sources to get used to these xml scripts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 13:03:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/copying-Parent-XML-tag-value-to-child-tag-value/m-p/348438#M235366</guid>
      <dc:creator>PradNiFi1236</dc:creator>
      <dc:date>2022-07-21T13:03:47Z</dc:date>
    </item>
  </channel>
</rss>

