Topic
  • 4 replies
  • Latest Post - ‏2013-07-26T12:33:41Z by HermannSW
RS_DP
RS_DP
37 Posts

Pinned topic Have to send a part of request xml as HTML using XSL to backend

‏2013-07-24T18:05:14Z |

I have requirement where I need to send a part of request xml  as html to backend

Sample Part of Request xml :



<abc>  
<def 
ghi
=
"jkl"
>
mnop
</def>
</abc>

Expected output for this part of request xml :



&gt;&lt;abc&gt;&lt;def ghi="jkl"&gt;mnop&lt;/def&gt;&lt;/abc&gt;

 

Tried CDATA and using disable output-espacing but it didnt work. Could you suggest me how to pass few tags in the request xml as mentioned above.

 



<xsl:text 
disable-output-escaping
=
"yes"
>
&lt;![CDATA[
</xsl:text> 
<xsl:copy-of 
select
=
"$op1"
/> 
<xsl:text 
disable-output-escaping
=
"yes"
>
]]&gt;
</xsl:text>

where op1 is variable containing



<abc>  
<def 
ghi
=
"jkl"
>
mnop
</def>
</abc>

Thanks in advance!!

Updated on 2013-07-24T18:15:27Z at 2013-07-24T18:15:27Z by RS_DP
  • RS_DP
    RS_DP
    37 Posts

    Re: Have to send a part of request xml as HTML using XSL to backend

    ‏2013-07-24T18:17:07Z  

    I used below code : <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
    <xsl:copy-of select ="$op1"/>
    <xsl:text disable-output-escaping="yes">]]&gt;
    </xsl:text>

     

    where op1 is variable containing



    <abc>  
    <def ghi="jkl">mnop</def>
    </abc>
     

    Didnt post properly.. But it didnt work anyways.

  • HermannSW
    HermannSW
    6065 Posts

    Re: Have to send a part of request xml as HTML using XSL to backend

    ‏2013-07-24T21:36:18Z  
    • RS_DP
    • ‏2013-07-24T18:17:07Z

    I used below code : <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
    <xsl:copy-of select ="$op1"/>
    <xsl:text disable-output-escaping="yes">]]&gt;
    </xsl:text>

     

    where op1 is variable containing



    <abc>  
    <def ghi="jkl">mnop</def>
    </abc>
     

    Didnt post properly.. But it didnt work anyways.

    Your initial requirement is serialization of the XML.

    Please try this to serialize the full XML document:

    <dp:serialize select="/" omit-xml-decl="yes"/>

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • RS_DP
    RS_DP
    37 Posts

    Re: Have to send a part of request xml as HTML using XSL to backend

    ‏2013-07-25T14:11:51Z  
    • HermannSW
    • ‏2013-07-24T21:36:18Z

    Your initial requirement is serialization of the XML.

    Please try this to serialize the full XML document:

    <dp:serialize select="/" omit-xml-decl="yes"/>

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Thanks Hermann. I tried below however cant saw the value in probe. Do you see anything minor missing. Please advise.

    <xsl:template match="/">
            <xsl:variable name="op2">
                <dp:serialize select="$op1" omit-xml-decl="yes"/>
             </xsl:variable>
             <dp:set-variable name="'var://context/op/node'" value="$op2"/>
        </xsl:template>

    where op1 is variable : <xsl:variable name="op1">

    <abc>
    <def ghi="jkl">mnof</def>
    </abc>
     

  • HermannSW
    HermannSW
    6065 Posts

    Re: Have to send a part of request xml as HTML using XSL to backend

    ‏2013-07-26T12:33:41Z  
    • RS_DP
    • ‏2013-07-25T14:11:51Z

    Thanks Hermann. I tried below however cant saw the value in probe. Do you see anything minor missing. Please advise.

    <xsl:template match="/">
            <xsl:variable name="op2">
                <dp:serialize select="$op1" omit-xml-decl="yes"/>
             </xsl:variable>
             <dp:set-variable name="'var://context/op/node'" value="$op2"/>
        </xsl:template>

    where op1 is variable : <xsl:variable name="op1">

    <abc>
    <def ghi="jkl">mnof</def>
    </abc>
     

    Your template does not produce output.

    It just store the serialized string in context variable.

    You can see that variable under "Context Variables" tab in Probe, but only for context "op".

    If "op" is not the input context of any action, you may want to add a dummy "op--Results--NULL" action somewhere after the xform action setting the context variable. That way you can inspect the result of your stylesheet in Probe as described above.

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>