Integration

Get Involved. Join the Conversation.

Topic

    Yazan Mohammad
    How I can extraxt xml tag inside CDATA in XSLAnswered
    Topic posted September 25, 2019 by Yazan MohammadGreen Ribbon: 100+ Points, tagged E-Business Suite, PaaS, REST, xml 
    91 Views, 8 Comments
    Title:
    How I can extraxt xml tag inside CDATA in XSL
    Summary:
    Extract USER_ID tag value from CDATA
    Content:
    <X_USER_XML><![CDATA[<?xml version="1.0"?>
    <ROWSET>
     <ROW>
      <USER_ID>5086</USER_ID>
    
    </ROW>
    </ROWSET>]]></X_USER_XML>
    

    Best Comment

    Kanchankumar Khedkar

    You can use ora:parseXml or ora:parseEscapedXml . take this into the a variable and get on that variable write xpath. 

    Sample code snippet :

    <xsl:variable name="escapedVar" select="ora:parseXml($input/X_USER_XML)" />

    <output>

    <xsl:value-of select="$escapedVar/ROW/USER_ID"/> 

    </output> 

     

    Comment

     

    • Kanchankumar Khedkar

      You can use ora:parseXml or ora:parseEscapedXml . take this into the a variable and get on that variable write xpath. 

      Sample code snippet :

      <xsl:variable name="escapedVar" select="ora:parseXml($input/X_USER_XML)" />

      <output>

      <xsl:value-of select="$escapedVar/ROW/USER_ID"/> 

      </output> 

       

      • Anonymousposted September 25, 2019
        This has been deleted by the author
        • Kanchankumar Khedkar

          I don't think that would be a problem. You can try something like below:

          <xsl:variable name="escapedVar" select="ora:parseXml($input/X_USER_XML)" />

          <output>

          <xsl:for-each select="$escapedVar//ROW"> 

             <xsl:value-of select="concat(USER_ID, ',' , USER_NAME"/> 

          </xsl:for-each>

          </output> 

          This would give you output - 

          <output>

          5086,YAZAN
          5089,Mohammad

          </output>

      • Yazan Mohammad

        Thank you very much!

        The problem has been resolved

      • Mani

        can this be done in an Assign action or does it have to be a Map action? appreciate if someone can provide a screenshot on how this can be done. I am not very familiar with XSL.

        • Kanchankumar Khedkar
          Hello Mani, As per my knowledge at this moment it is possible to use assign activity for this. You can create a schema nxsd for the xml content inside CDATA. And use write content CDATA to file using stage and the. Read it and use it in assign.
          • Mani

            Hi Kanchan,

            thanks for the quick response. so far I've been using stage read and write approach and that works well. but looking at your suggestion above, thought I can get rid of extra two stage actions. So, that logic can't be implemented in Assign action directly right?