-2

I am new to xlst maps and I am getting crazy with a transformation.

I want to map this

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header xmlns:get="http://saber.foxinc.com/SintecDB/getTedialIngestMetadata"/>
   <soapenv:Body xmlns:get="http://saber.foxinc.com/SintecDB/getTedialIngestMetadata">
      <processResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://saber.foxinc.com/SintecDB/getTedialIngestMetadata">
         <progMediaRecord>
            <episodeNo>3</episodeNo>
            <episodeId>xxxx</episodeId>
            <title>Lake Hunters</title>       
         </progMediaRecord>
      </processResponse>
   </soapenv:Body>
</soapenv:Envelope>

into this

<cataloging>
<metadata name="EPISODE_NUMBER">3</metadata>
<metadata name="EPISODE_ID">xxxxx</metadata>
<metadata name="EPISODE_TITLE">Lake Hunters</metadata>
</cataloging>

I read that I should use a template but I am quite lost. Does anyone have any idea?

Many thanks!

Jesus Paradinas
  • 189
  • 2
  • 12
  • If you showed us how and where you got lost, then we would be able to see what concept you haven't grasped, and could help you over that hurdle. Unless you are specific about what you tried and where you failed, you're essentially just asking someone to write the code for you, which doesn't make a good SO question. – Michael Kay Nov 26 '18 at 23:19

1 Answers1

0

Here are a couple of the template rules you might use in your solution:

<xsl:template match="progMediaRecord">
  <cataloging><xsl:apply-templates/></cataloging>
</xsl:template>

<xsl:template match="episodeNo">
  <metaData name="EPISODE_NUMBER"><xsl:value-of select="."/></metaData>
</xsl:template>

Hope that gives you some ideas.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • Thanks Michael. To get the value of episodeNo I am trying this and this Any idea why I have no luck? – Jesus Paradinas Nov 27 '18 at 06:32
  • @JesusParadinas - You also need to account for the default namespace. See https://stackoverflow.com/questions/1344158/xslt-with-xml-source-that-has-a-default-namespace-set-to-xmlns – Daniel Haley Nov 27 '18 at 06:36
  • Sorry I missed the default namespace declaration which you can see by scrolling horizontally. – Michael Kay Nov 27 '18 at 12:00