IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  How do I create CDATA section in output?

    Posted Thu October 14, 2004 06:08 PM

    Hi,

    I’m trying to put a CDATA in my output, something like this.

    <?xml version="1.0" encoding="UTF-8"?>

    <![CDATA[update for $a in input()/Process where $a/ID = 'eee36c' do replace $a/Name with Jean]]>


    I can’t use entities as the xml fragment is copied from another document. Any ideas?

    Regards,
    Jean


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: How do I create CDATA section in output?

    Posted Fri October 15, 2004 05:17 PM

    <xsl:output cdata-section-elements=“query”/>


    #webMethods
    #API-Management
    #Tamino


  • 3.  RE: How do I create CDATA section in output?

    Posted Fri October 15, 2004 05:36 PM

    Unfortunately that doesn’t work if you have xml elements within that element.


    #API-Management
    #webMethods
    #Tamino


  • 4.  RE: How do I create CDATA section in output?

    Posted Mon October 18, 2004 10:08 PM



    I?m not sure I understand this statement. Isn?t the whole point of CDATA that it?s just character data, not elements or attributes or any such, even if it contains characters that would normally constitute markup?


    #Tamino
    #API-Management
    #webMethods


  • 5.  RE: How do I create CDATA section in output?

    Posted Tue October 19, 2004 01:02 PM

    Hi Curtis,

    What I mean is that if you create elements within the quote element (like Jean) and you use xsl:output cdata-section-elements=“query”, then the quote element won’t specify cdata.

    It will create the following

    update for $a in input()/Process where $a/ID = ‘eee36c’ do replace $a/Name with Jean


    I can’t have it like that as I’m getting the value via xpath in Mediator, and that only returns the text.


    #webMethods
    #Tamino
    #API-Management


  • 6.  RE: How do I create CDATA section in output?

    Posted Tue October 19, 2004 10:32 PM

    If there?s really an element (as opposed to text that happens to look like an element) then you really can?t use CDATA.

    Maybe what you really want is something like this:

    <xsl:output cdata-section-elements="query"/>
    <xsl:template select="node-to-update">
    <query>update for $a in input()/Process
    where $a/ID = &apos;<xsl:value-of select="@id"/>&apos; do
    replace $a/Name with
    <Name><xsl:value-of select="Name"/></Name></query>
    </xsl:template> 



    The point being that what appears as an element in the output is really just text, not an XML element.


    #API-Management
    #Tamino
    #webMethods


  • 7.  RE: How do I create CDATA section in output?

    Posted Fri October 22, 2004 03:09 PM

    Hi Chris,

    In the end I decided to use the following transformation to create entities. It is however not really what I want as the result doesn’t look nice and isn’t very readable with all the ampersands etc. Just thought that maybe I could wrap it in a CDATA section but guess I can’t.

     	<xsl:template match="/">
    <Output>
    <xsl:apply-templates mode="queryDocument" select="*"/>
    </Output>
    </xsl:template>
    <!-- Recursively copy elements and attributes of result -->
    <xsl:template match="*" mode="queryDocument">
    <xsl:text><</xsl:text>
    <xsl:value-of select="local-name()"/>
    <xsl:for-each select="@*">
    <xsl:text> </xsl:text>
    <xsl:value-of select="local-name()"/>
    <xsl:text>="</xsl:text>
    <xsl:value-of select="."></xsl:value-of>
    <xsl:text>="</xsl:text>
    </xsl:for-each>
    <xsl:text>></xsl:text>
    <xsl:apply-templates mode="queryDocument"/>
    <xsl:text></</xsl:text>
    <xsl:value-of select="local-name()"/>
    <xsl:text>></xsl:text>
    </xsl:template>

    #Tamino
    #API-Management
    #webMethods


  • 8.  RE: How do I create CDATA section in output?

    Posted Fri October 22, 2004 03:15 PM

    For some reason all the entities are changed to < > etc. It doesn’t post right.


    #Tamino
    #webMethods
    #API-Management