You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrei Bejenaru <ab...@interakt.ro> on 2001/08/27 11:14:28 UTC

how to view the generated xml ?

I would like to check the XML generated from a XSP. How can I do it?

Re: how to view the generated xml ?

Posted by Martin Man <Ma...@seznam.cz>.
On Mon, Aug 27, 2001 at 12:14:28PM +0300, Andrei Bejenaru wrote:
> I would like to check the XML generated from a XSP. How can I do it?

append ?cocoon-view=content to the URL, and then see the source returned,
presumming you have corectly configured views in your sitemap

rgds,
martin

-- 
-------------------------------------------------------------------------------
"Only dead fish swims with a stream"                         Malcolm Muggeridge
gpg_key_available: http://globales.cz/~mman/martin.man.gpg
gpg_key_fingerprint: 2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: how to view the generated xml ?

Posted by Enke Michael <Mi...@wincor-nixdorf.com>.
Andrei Bejenaru wrote:
> 
> I would like to check the XML generated from a XSP. How can I do it?

Comment out the <transform - to - html - or - whatever> tag in the
sitemap.
Depending on which browser you use you must view the source, that's the
xml.

Michael

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: how to view the generated xml ?

Posted by Cyril Cambien <cc...@ivision.fr>.
My advice is to have 2  pipeline definitions. One usual, the other for
debugging purpose
For instance:

   <!-- Normal processing -->
   <map:match pattern="*.xsp">
     <map:generate type="serverpages" src="docs/{1}.xsp"/>
     <map:transform src="stylesheets/{1}.xsl"/>
     <map:serialize type="html"/>
   </map:match>

   <!-- Only generate XML -->
   <map:match pattern="debug/*.xsp">
     <map:generate type="serverpages" src="docs/{1}.xsp"/>
     <map:serialize type="xml"/>
   </map:match>

Then access http://localhost:8080/yourapp/debug/foo.xsp

You can also use the xml.xsl stylesheet I pasted at the end off this
this email. It converts your XML in HTML representation. Just add the
following in  the sitemap

   <!-- generate XML  and render the XML code as HTML -->
   <map:match pattern="debug2/*.xsp">
     <map:generate type="serverpages" src="docs/{1}.xsp"/>
     <map:transform src="stylesheets/xml.xsl"/>
     <map:serialize type="html"/>
   </map:match>



---- xml.xsl :::


<?xml version="1.0"?>

<!--
 |
 | XSLT REC Compliant Version of IE5 Default Stylesheet
 |
 | Original version by Jonathan Marsh (jmarsh@microsoft.com)
 | http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl
 |
 | Conversion to XSLT 1.0 REC
      Syntax by Steve Muench (smuench@oracle.com)
 |
 +-->
<xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output indent="no" method="html"/>

   <xsl:template match="/">
      <html>
<head>
<script language="javascript">
   <![CDATA[
      function f(e){
         if (e.className=="ci") {
          if (e.children(0).innerText.indexOf("\n")>0) fix(e,"cb");
         }
         if (e.className=="di") {
          if (e.children(0).innerText.indexOf("\n")>0) fix(e,"db");
         }
         e.id="";
      }
      function fix(e,cl){
        e.className=cl;
        e.style.display="block";
        j=e.parentElement.children(0);
        j.className="c";
        k=j.children(0);
        k.style.visibility="visible";
        k.href="#";
      }
      function ch(e) {
        mark=e.children(0).children(0);
        if (mark.innerText=="+") {
          mark.innerText="-";
          for (var i=1;i<e.children.length;i++) {
            e.children(i).style.display="block";
          }
        }
        else if (mark.innerText=="-") {
          mark.innerText="+";
          for (var i=1;i<e.children.length;i++) {
            e.children(i).style.display="none";
          }
        }
      }
      function ch2(e) {
        mark=e.children(0).children(0);
        contents=e.children(1);
        if (mark.innerText=="+") {
          mark.innerText="-";
          if (contents.className=="db"||contents.className=="cb") {
            contents.style.display="block";
          }
          else {
            contents.style.display="inline";
          }
        }
        else if (mark.innerText=="-") {
          mark.innerText="+";
          contents.style.display="none";
        }
      }
      function cl() {
        e=window.event.srcElement;
        if (e.className!="c") {
          e=e.parentElement;
          if (e.className!="c") {
            return;
          }
        }
        e=e.parentElement;
        if (e.className=="e") {
     ch(e);
        }
        if (e.className=="k") {
            ch2(e);
        }
 return false;
      }
      function ex(){}
      function h() {window.status="";}
      function yo(e) { window.alert(e); }
      document.onclick=cl;
      window.status="Displaying XML Document";
      ]]>
  </script>

     <STYLE>
    BODY {font:x-small 'Verdana' 'Arial' 'Helvetica';
margin-right:1.5em}
    .c  {cursor:hand}
    .b  {color:red; font-family:'Courier New'; font-weight:bold;
         text-decoration:none}
    .e  {margin-left:1em; text-indent:-1em; margin-right:1em}
    .k  {margin-left:1em; text-indent:-1em; margin-right:1em}
    .t  {color:#990000}
    .xt {color:#990099}
    .ns {color:red}
    .dt {color:green}
    .m  {color:blue}
    .tx {font-weight:bold}
    .db {text-indent:0px; margin-left:1em; margin-top:0px;
         margin-bottom:0px;padding-left:.3em;
         border-left:1px solid #CCCCCC; font:small Courier}
    .di {font:small Courier}
    .d  {color:blue}
    .pi {color:blue}
    .cb {text-indent:0px; margin-left:1em; margin-top:0px;
         margin-bottom:0px;padding-left:.3em; font:small Courier;
         color:#888888}
    .ci {font:small Courier; color:#888888}
    PRE {margin:0px; display:inline}
 </STYLE>
 <TITLE>XML Document</TITLE>
         </head>
         <BODY class="st">
            <xsl:apply-templates/>
         </BODY>
      </html>
   </xsl:template>

   <xsl:template match="processing-instruction()">
      <DIV class="e">
         <SPAN class="b">
    &#160;
         </SPAN>
         <SPAN class="m">
            <xsl:text>&lt;?</xsl:text>
         </SPAN>
         <SPAN class="pi">
            <xsl:value-of select="name(.)"/>
     <xsl:text> </xsl:text>
            <xsl:value-of select="."/>
         </SPAN>
         <SPAN class="m">
            <xsl:text>?&gt;</xsl:text>
         </SPAN>
      </DIV>
   </xsl:template>

   <xsl:template match="processing-instruction('xml')">
      <DIV class="e">
         <SPAN class="b">
   &#160;
         </SPAN>
         <SPAN class="m">
            <xsl:text>&lt;?</xsl:text>
         </SPAN>
         <SPAN class="pi">
            <xsl:text>xml </xsl:text>
            <xsl:for-each select="@*">
               <xsl:value-of select="name(.)"/>
               <xsl:text>="</xsl:text>
               <xsl:value-of select="."/>
               <xsl:text>" </xsl:text>
            </xsl:for-each>
         </SPAN>
         <SPAN class="m">
            <xsl:text>?gt;</xsl:text>
         </SPAN>
      </DIV>
   </xsl:template>

   <xsl:template match="@*">
      <SPAN>
         <xsl:attribute name="class">
            <xsl:if test="xsl:*/@*">
              <xsl:text>x</xsl:text>
            </xsl:if>
            <xsl:text>t</xsl:text>
         </xsl:attribute>
         <xsl:value-of select="name(.)"/>
      </SPAN>
      <SPAN class="m">="</SPAN>
      <B>
         <xsl:value-of select="."/>
      </B>
      <SPAN class="m">"&#32;</SPAN>
   </xsl:template>

   <xsl:template match="text()">
      <DIV class="e">
         <SPAN class="b"> </SPAN>
         <SPAN class="tx">
            <xsl:value-of select="."/>
         </SPAN>
      </DIV>
   </xsl:template>

   <xsl:template match="comment()">
      <DIV class="k">
         <SPAN>
            <A STYLE="visibility:hidden"
                 class="b" onclick="return false;"
               onfocus="h(); ">-</A>
            <SPAN class="m">
               <xsl:text>&lt;!--</xsl:text>
            </SPAN>
         </SPAN>
         <SPAN class="ci" id="clean">
            <PRE>
               <xsl:value-of select="."/>
            </PRE>
         </SPAN>
         <SPAN class="b">
    &#160;
         </SPAN>
         <SPAN class="m">
            <xsl:text>--&gt;</xsl:text>
         </SPAN>
         <script>f(clean);</script>
      </DIV>
   </xsl:template>

   <xsl:template match="*">
      <DIV class="e">
         <DIV STYLE="margin-left:1em;text-indent:-2em">
            <SPAN class="b">
     &#160;
            </SPAN>
            <SPAN class="m">&lt;</SPAN>
            <SPAN>
               <xsl:attribute name="class">
                  <xsl:if test="xsl:*">
                     <xsl:text>x</xsl:text>
                  </xsl:if>
                  <xsl:text>t</xsl:text>
               </xsl:attribute>
               <xsl:value-of select="name(.)"/>
               <xsl:if test="@*">
                  <xsl:text> </xsl:text>
               </xsl:if>
            </SPAN>
            <xsl:apply-templates select="@*"/>
            <SPAN class="m">
               <xsl:text>/&gt;</xsl:text>
            </SPAN>
         </DIV>
      </DIV>
   </xsl:template>

   <xsl:template match="*[node()]">
      <DIV class="e" >

         <DIV class="c">
            <a class="b" href="#" onfocus="h(); ">-</a>
            <SPAN class="m">&lt;</SPAN>
            <SPAN>
               <xsl:attribute name="class">
                  <xsl:if test="xsl:*">
                     <xsl:text>x</xsl:text>
                  </xsl:if>
                  <xsl:text>t</xsl:text>
               </xsl:attribute>
               <xsl:value-of select="name(.)"/>
               <xsl:if test="@*">
                  <xsl:text> </xsl:text>
               </xsl:if>
            </SPAN>
            <xsl:apply-templates select="@*"/>
            <SPAN class="m">
               <xsl:text>&gt;</xsl:text>
            </SPAN>
         </DIV>
         <DIV>
            <xsl:apply-templates/>
            <DIV>
               <SPAN class="b">
     &#160;
               </SPAN>
               <SPAN class="m">
                  <xsl:text>&lt;/</xsl:text>
               </SPAN>
               <SPAN>
                  <xsl:attribute name="class">
                     <xsl:if test="xsl:*">
                        <xsl:text>x</xsl:text>
                     </xsl:if>
                     <xsl:text>t</xsl:text>
                  </xsl:attribute>
                  <xsl:value-of select="name(.)"/>
               </SPAN>
               <SPAN class="m">
                  <xsl:text>&gt;</xsl:text>
               </SPAN>
            </DIV>
         </DIV>
      </DIV>
   </xsl:template>

   <xsl:template match="*[text() and
            not (comment() or processing-instruction())]">
      <DIV class="e">
         <DIV STYLE="margin-left:1em;text-indent:-2em">
            <SPAN class="b">
     &#160;
            </SPAN>
            <SPAN class="m">
               <xsl:text>&lt;</xsl:text>
            </SPAN>
            <SPAN>
               <xsl:attribute name="class">
                  <xsl:if test="xsl:*">
                     <xsl:text>x</xsl:text>
                  </xsl:if>
                  <xsl:text>t</xsl:text>
               </xsl:attribute>
               <xsl:value-of select="name(.)"/>
               <xsl:if test="@*">
                  <xsl:text> </xsl:text>
               </xsl:if>
            </SPAN>
            <xsl:apply-templates select="@*"/>
            <SPAN class="m">
               <xsl:text>&gt;</xsl:text>
            </SPAN>
            <SPAN class="tx">
               <xsl:value-of select="."/>
            </SPAN>
            <SPAN class="m">&lt;/</SPAN>
            <SPAN>
               <xsl:attribute name="class">
                  <xsl:if test="xsl:*">
                     <xsl:text>x</xsl:text>
                  </xsl:if>
                  <xsl:text>t</xsl:text>
               </xsl:attribute>
               <xsl:value-of select="name(.)"/>
            </SPAN>
            <SPAN class="m">
               <xsl:text>&gt;</xsl:text>
            </SPAN>
         </DIV>
      </DIV>
   </xsl:template>

   <xsl:template match="*[*]" priority="20">
      <DIV class="e" >
         <DIV STYLE="margin-left:1em;text-indent:-2em" class="c">
            <a class="b" href="#" onfocus="return h();">-</a>
            <SPAN class="m">&lt;</SPAN>
            <SPAN>
               <xsl:attribute name="class">
                  <xsl:if test="xsl:*">
                     <xsl:text>x</xsl:text>
                  </xsl:if>
                  <xsl:text>t</xsl:text>
               </xsl:attribute>
               <xsl:value-of select="name(.)"/>
               <xsl:if test="@*">
                  <xsl:text> </xsl:text>
               </xsl:if>
            </SPAN>
            <xsl:apply-templates select="@*"/>
            <SPAN class="m">
               <xsl:text>&gt;</xsl:text>
            </SPAN>
         </DIV>
         <DIV>
            <xsl:apply-templates/>
            <DIV>
               <SPAN class="b">
     &#160;
               </SPAN>
               <SPAN class="m">
                  <xsl:text>&lt;/</xsl:text>
               </SPAN>
               <SPAN>
                  <xsl:attribute name="class">
                     <xsl:if test="xsl:*">
                        <xsl:text>x</xsl:text>
                     </xsl:if>
                     <xsl:text>t</xsl:text>
                  </xsl:attribute>
                  <xsl:value-of select="name(.)"/>
               </SPAN>
               <SPAN class="m">
                  <xsl:text>&gt;</xsl:text>
               </SPAN>
            </DIV>
         </DIV>
      </DIV>
   </xsl:template>

   <xsl:template name="entity-ref">
      <xsl:param name="name"/>
      <xsl:text>&#38;</xsl:text>
      <xsl:value-of select="$name"/>
      <xsl:text>;</xsl:text>
   </xsl:template>

</xsl:stylesheet>



Andrei Bejenaru wrote:

> I would like to check the XML generated from a XSP. How can I do it?


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>