Topic
4 replies Latest Post - ‏2013-07-26T12:33:41Z by HermannSW
RS_DP
RS_DP
31 Posts
ACCEPTED ANSWER

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
    31 Posts
    ACCEPTED ANSWER

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

    ‏2013-07-24T18:17:07Z  in response to RS_DP

    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
      4320 Posts
      ACCEPTED ANSWER

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

      ‏2013-07-24T21:36:18Z  in response to RS_DP

      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
        31 Posts
        ACCEPTED ANSWER

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

        ‏2013-07-25T14:11:51Z  in response to HermannSW

        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
          4320 Posts
          ACCEPTED ANSWER

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

          ‏2013-07-26T12:33:41Z  in response to RS_DP

          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/>