XSLT Trasformation-Header

Discussions

XML & Web services: XSLT Trasformation-Header

  1. XSLT Trasformation-Header (2 messages)

    Hi,
    I have a soap message with
    <soap:Header>--some header info--</soap:Header>
    <soap:Body>--contents--</soaop:Body>

    In my process, i need to take out the Header info that exist and just make the make the soap message left with empty Header element(<soap:Header></soap:Header>).

    Can you please suggest how to do this using XSLT?

    thanks & Regadrs,
    Soumya

    Threaded Messages (2)

  2. XSLT Trasformation-Header[ Go to top ]

    Deal with name spaces as a separate issue, but the problem can be solved as an example below. All you do is skip the header content.

    XSLT FILE EXAMPLE
    -----------------
    <xsl:stylesheet version = '1.0'
         xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

    <xsl:template match="/">
         <message>
          <Header>
          <xsl:apply-templates select="Header"/>
          </Header>

          <Body>
                   <xsl:value-of select="//Body" />
    </Body>
         </message>
    </xsl:template>

    <xsl:template match="Header">
    </xsl:template>

    </xsl:stylesheet>

    INPUTE EXAMPLE
    --------------
    <message>
    <Header>--some header info--</Header>
    <Body>--contents--</Body>
    </message>

    OUTPUT
    ------
    <?xml version="1.0" encoding="UTF-16"?><message><Header></Header><Body>--contents--</Body></message>
  3. XSLT Trasformation-Header[ Go to top ]

    Hi srinivas,
    That works fine.. Thanks a lot.

    regards,
    soumya