You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Shan Gopalakrishnan <sg...@cisco.com> on 2002/05/02 06:53:12 UTC

xsl portlet.

folks

Any idea how to use xsl portlet. if someone has an example that would be 
great.  Also my xml input is in the form
of  string and how would I pass it the XSL Portlet as it expects xml data 
input in the form of  http. appreciate
any help on this.

- Shan


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


Re: Portlet look and feel

Posted by Kamal Muthuswamy <ka...@mailer.csit.fsu.edu>.
Hi

I also want to use images in place of title text. First of all is it
possible? If yes, then how can go about doing it?

Also I wanted to know how can I differenciate between the title shown
on the top (like home page, rss, dynamic that comes with default) with
the titles of portlets i.e I want to have seperate properties for both
of them. Where and how do I configure that?

I looked into the archive and found the following question to be the
nearest to the one I wanted to know but there were no replies to it.

Any help would be appreciated
Regards

Kamal

> Hi.
>
> I'm working with JetSpeed, trying to change the way portlets look. I'm
> having some
> trouble finding the place where the portlet HTML code is generated. I
> want
> to change
> the title background color into an image and stuff like that. I don't
> want
> to use the
> skin config, since it only change colors and styles, I want to add
> images
> to them.
>
> TIA
> RR.







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


Re: xsl portlet.

Posted by Shan Gopalakrishnan <sg...@cisco.com>.
Anand

Good points.  I still didnt probably give you the right requirement.

I have a ejb in the app. server  which returns a xml string .  This ejb is 
called by rmi/iiop from the Portlet class.  Now I'm looking
at using this xml string as an input to the xsl.  If you see the portlet 
definition, it takes a vm uri.  I'm not sure why should I use
a vm ?  Appreciate any of your inputs on this.  Thanks

- Shan





At 01:05 PM 5/2/2002 +0530, anand wrote:
>What you are asking is what i think is being done.....
>You saw how to configure your xsl portlet.Now
>see if you are using a portlet which uses xsl for outputing
>then it would be like this
>
><portlet-entry name="Shan" hidden="false" type="ref"
>        parent="XSL" application="false">
>        <meta-info>
>            <title>Shan</title>
>        </meta-info>
>        <url>/shan/servlet/shan/template/shan.vm</url>
>    </portlet-entry>
>
>       If you not you are calling the parent as XSL and specifying
>that this should take input from the url.So the url will be outputing
>xml and that will serve as the input for xsl.I am sorry i missed this.
>Hope it is clear now....Enjoy
>
>-Anand
>
>Shan Gopalakrishnan wrote:
>
>>also Anand, where are u specifying the xml input to the xsl portlet.
>>I see the xsl file is mentioned.
>>      <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
>> hidden="false">  but how about the xml file?
>>probably i'm missing something.
>>
>>
>>At 12:27 PM 5/2/2002 +0530, anand wrote:
>>
>>>Hai Shan,
>>>1.     This is how you you place your XSL in portels.xreg
>>>
>>><portlet-entry name="XSL" hidden="false" type="abstract" 
>>>application="false">
>>>
>>><classname>org.apache.jetspeed.portal.portlets.ShanXSLPortlet</classname>
>>>        <parameter name="host" value="localhost" hidden="false"/>
>>>        <parameter name="port" value="8080" hidden="false"/>
>>>        <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
>>> hidden="false">
>>>            <security role="admin"/>
>>>        </parameter>
>>>    </portlet-entry>
>>>
>>>2.Say your vm/jsp will output a xml and this will be the input to
>>>   your xsl.This sample vm shows how to output the form.....
>>>
>>><shan>
>>>  <shan_form>
>>>    <action>/shan/portal/pane0/ShanPortal</action>
>>>    <method>post</method>
>>>    <onsubmit>return validate(this)</onsubmit>
>>>    <input type="text" name="searchstring" display="" value=""/>
>>>    <input type="submit" name="search" value="search" />
>>>    <input type="hidden" name="nodeId" value="$nodeId" />
>>>    <input type="hidden" name="userId" value="$userId" />
>>>  </shan_form>
>>></shan>
>>>
>>>3.If your vm is outputing in such a way then you can
>>>   use the below sample of xsl.....
>>>
>>><xsl:template match="shan/shan_form">
>>>      <form name="{name}" action="{action}" method="{method}" 
>>> onSubmit="{onsubmit}" enctype="{enctype}">
>>>         <table>
>>>          <xsl:for-each select="input">
>>>             <xsl:variable name="type" select="@type" />
>>>                <!--      TYPE AREA     -->
>>>                <xsl:if test="$type='area'">
>>>                 <tr>
>>>                 <td>                   <b><xsl:value-of 
>>> select='@display' /></b>
>>>                 </td>
>>>                 <td>
>>>                   <textarea name="{@name}" rows="{@rows}" cols="{@cols}">
>>>                     <xsl:for-each select="value">
>>>                       <xsl:value-of select="." />
>>>                     </xsl:for-each>
>>>                   </textarea>
>>>                 </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>               <!--      DISPLAY     -->
>>>
>>>               <xsl:if test="$type='display'">
>>>                 <tr>
>>>                   <td>
>>>                     <b><xsl:value-of select='@display' /></b>
>>>                   </td>
>>>                   <td>
>>>                      <xsl:value-of select='@value' />
>>>                   </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>
>>>               <!--      SELECT     -->
>>>
>>>               <xsl:if test="$type='select'">
>>>                 <tr>
>>>                   <td colspan='2'>
>>>                   <select name='{@name}' size='{@size}' 
>>> multiple="{@multiple}">
>>>                     <xsl:for-each select="option">
>>>                       <xsl:variable name ="selected" select="@selected" />
>>>                         <xsl:if test= "$selected = 'selected'">
>>>                           <option value ='{@value}' selected='{selected}'>
>>>                             <xsl:value-of select='@display' />
>>>                           </option>
>>>                         </xsl:if>
>>>                         <xsl:if test= "$selected = 'notselected'">
>>>                           <option value ='{@value}'>
>>>                             <xsl:value-of select='@display' />
>>>                           </option>
>>>                         </xsl:if>
>>>                     </xsl:for-each>
>>>                   </select>
>>>                   </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>
>>>               <!--     DROP DOWN     -->
>>>
>>>               <xsl:if test="$type='dropdown'">
>>>                 <tr>
>>>                 <td>                   <b><xsl:value-of 
>>> select='@display' /></b>
>>>                 </td>
>>>                 <td>
>>>                   <select name='{@name}' size='{@size}'>
>>>                     <xsl:for-each select="option">
>>>                       <xsl:variable name="type" select="@selected" />
>>>                         <xsl:if test="$type='true'">
>>>                           <option value='{@value}' selected='{@selected}'>
>>>                             <xsl:value-of select="." />
>>>                           </option>
>>>                         </xsl:if>
>>>                       <xsl:if test="$type='false'">
>>>                         <option value='{@value}'>
>>>                           <xsl:value-of select="." />
>>>                         </option>
>>>                       </xsl:if>                     </xsl:for-each>
>>>                   </select>
>>>                 </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>
>>>               <!--     TYPE FILE     -->
>>>
>>>
>>>               <xsl:if test="$type='file'">
>>>                  <tr>
>>>                  <td>
>>>                    <b><xsl:value-of select='@display' /></b>
>>>                   </td>
>>>                   <td>
>>>                    <input name='{@name}' type='{@type}' value='{@value}' />
>>>                  </td>
>>>                 </tr>
>>>               </xsl:if>
>>>               <xsl:if test="$type='text'">
>>>                 <tr>
>>>                   <td>
>>>                     <b><xsl:value-of select='@display' /></b>
>>>                   </td>
>>>                   <td>
>>>                     <input name='{@name}' type='{@type}' 
>>> value='{@value}' maxlength='{@maxlength}' size='{@size}'/>
>>>                   </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>               <!--      TYPE CHECK BOX     -->
>>>
>>>               <xsl:if test="$type='checkbox'">
>>>                 <tr>
>>>                   <td>
>>>                     <b><xsl:value-of select='@display' /></b>
>>>                   </td>
>>>                   <td>
>>>                     <xsl:variable name="checked" select="@checked" />
>>>                     <xsl:if test="$checked='true'">
>>>                       <input name='{@name}' type='{@type}' 
>>> value='{@value}' checked='{@checked}' />
>>>                     </xsl:if>
>>>                     <xsl:if test="$checked='false'">
>>>                       <input name='{@name}' type='{@type}' 
>>> value='{@value}' />
>>>                     </xsl:if>                   </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>               <!--      TYPE HIDDEN     -->
>>>
>>>               <xsl:if test="$type='hidden'">
>>>                 <tr>
>>>                   <td colspan='2'>
>>>                     <input name='{@name}' type='{@type}' 
>>> value='{@value}' />
>>>                   </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>               <!--      TYPE SUBMIT   and TYPE CANCEL  -->
>>>
>>>               <xsl:if test="$type='submit'">
>>>                 <tr>
>>>                   <td align="right">
>>>                     <input name='{@name}' type='{@type}' 
>>> value='{@value}' />
>>>
>>></td>
>>>
>>>                   <td align="left">
>>>                     <input name='cancel' type='button' value='Cancel' 
>>> onClick='javascript:history.back(1)' />                   </td>
>>>                 </tr>
>>>               </xsl:if>
>>>
>>>           </xsl:for-each>
>>>         </table>
>>>      </form>
>>>    </xsl:template>
>>>
>>>These examples may not be perfect to your use but this is some kind
>>>of sample and i guess this will help you.All the Best.
>>>
>>>-Anand
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org>
>>>For additional commands, e-mail: 
>>><ma...@jakarta.apache.org>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail: 
>><ma...@jakarta.apache.org>
>>
>>
>
>
>
>--
>To unsubscribe, 
>e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>


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


Re: xsl portlet.

Posted by anand <an...@eself.com>.
What you are asking is what i think is being done.....
You saw how to configure your xsl portlet.Now
see if you are using a portlet which uses xsl for outputing
then it would be like this

<portlet-entry name="Shan" hidden="false" type="ref"
        parent="XSL" application="false">
        <meta-info>
            <title>Shan</title>
        </meta-info>
        <url>/shan/servlet/shan/template/shan.vm</url>
    </portlet-entry>

       If you not you are calling the parent as XSL and specifying
that this should take input from the url.So the url will be outputing
xml and that will serve as the input for xsl.I am sorry i missed this.
Hope it is clear now....Enjoy

-Anand

Shan Gopalakrishnan wrote:

> also Anand, where are u specifying the xml input to the xsl portlet.  
> I see the xsl file is mentioned.
>      <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
> hidden="false">  but how about the xml file?
> probably i'm missing something.
>
>
> At 12:27 PM 5/2/2002 +0530, anand wrote:
>
>> Hai Shan,
>> 1.     This is how you you place your XSL in portels.xreg
>>
>> <portlet-entry name="XSL" hidden="false" type="abstract" 
>> application="false">
>>
>> <classname>org.apache.jetspeed.portal.portlets.ShanXSLPortlet</classname> 
>>
>>        <parameter name="host" value="localhost" hidden="false"/>
>>        <parameter name="port" value="8080" hidden="false"/>
>>        <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
>> hidden="false">
>>            <security role="admin"/>
>>        </parameter>
>>    </portlet-entry>
>>
>> 2.Say your vm/jsp will output a xml and this will be the input to
>>   your xsl.This sample vm shows how to output the form.....
>>
>> <shan>
>>  <shan_form>
>>    <action>/shan/portal/pane0/ShanPortal</action>
>>    <method>post</method>
>>    <onsubmit>return validate(this)</onsubmit>
>>    <input type="text" name="searchstring" display="" value=""/>
>>    <input type="submit" name="search" value="search" />
>>    <input type="hidden" name="nodeId" value="$nodeId" />
>>    <input type="hidden" name="userId" value="$userId" />
>>  </shan_form>
>> </shan>
>>
>> 3.If your vm is outputing in such a way then you can
>>   use the below sample of xsl.....
>>
>> <xsl:template match="shan/shan_form">
>>      <form name="{name}" action="{action}" method="{method}" 
>> onSubmit="{onsubmit}" enctype="{enctype}">
>>         <table>
>>          <xsl:for-each select="input">
>>             <xsl:variable name="type" select="@type" />
>>                <!--      TYPE AREA     -->
>>                <xsl:if test="$type='area'">
>>                 <tr>
>>                 <td>                   <b><xsl:value-of 
>> select='@display' /></b>
>>                 </td>
>>                 <td>
>>                   <textarea name="{@name}" rows="{@rows}" 
>> cols="{@cols}">
>>                     <xsl:for-each select="value">
>>                       <xsl:value-of select="." />
>>                     </xsl:for-each>
>>                   </textarea>
>>                 </td>
>>                 </tr>
>>               </xsl:if>
>>
>>               <!--      DISPLAY     -->
>>
>>               <xsl:if test="$type='display'">
>>                 <tr>
>>                   <td>
>>                     <b><xsl:value-of select='@display' /></b>
>>                   </td>
>>                   <td>
>>                      <xsl:value-of select='@value' />
>>                   </td>
>>                 </tr>
>>               </xsl:if>
>>
>>
>>               <!--      SELECT     -->
>>
>>               <xsl:if test="$type='select'">
>>                 <tr>
>>                   <td colspan='2'>
>>                   <select name='{@name}' size='{@size}' 
>> multiple="{@multiple}">
>>                     <xsl:for-each select="option">
>>                       <xsl:variable name ="selected" 
>> select="@selected" />
>>                         <xsl:if test= "$selected = 'selected'">
>>                           <option value ='{@value}' 
>> selected='{selected}'>
>>                             <xsl:value-of select='@display' />
>>                           </option>
>>                         </xsl:if>
>>                         <xsl:if test= "$selected = 'notselected'">
>>                           <option value ='{@value}'>
>>                             <xsl:value-of select='@display' />
>>                           </option>
>>                         </xsl:if>
>>                     </xsl:for-each>
>>                   </select>
>>                   </td>
>>                 </tr>
>>               </xsl:if>
>>
>>
>>               <!--     DROP DOWN     -->
>>
>>               <xsl:if test="$type='dropdown'">
>>                 <tr>
>>                 <td>                   <b><xsl:value-of 
>> select='@display' /></b>
>>                 </td>
>>                 <td>
>>                   <select name='{@name}' size='{@size}'>
>>                     <xsl:for-each select="option">
>>                       <xsl:variable name="type" select="@selected" />
>>                         <xsl:if test="$type='true'">
>>                           <option value='{@value}' 
>> selected='{@selected}'>
>>                             <xsl:value-of select="." />
>>                           </option>
>>                         </xsl:if>
>>                       <xsl:if test="$type='false'">
>>                         <option value='{@value}'>
>>                           <xsl:value-of select="." />
>>                         </option>
>>                       </xsl:if>                     </xsl:for-each>
>>                   </select>
>>                 </td>
>>                 </tr>
>>               </xsl:if>
>>
>>
>>               <!--     TYPE FILE     -->
>>
>>
>>               <xsl:if test="$type='file'">
>>                  <tr>
>>                  <td>
>>                    <b><xsl:value-of select='@display' /></b>
>>                   </td>
>>                   <td>
>>                    <input name='{@name}' type='{@type}' 
>> value='{@value}' />
>>                  </td>
>>                 </tr>
>>               </xsl:if>
>>               <xsl:if test="$type='text'">
>>                 <tr>
>>                   <td>
>>                     <b><xsl:value-of select='@display' /></b>
>>                   </td>
>>                   <td>
>>                     <input name='{@name}' type='{@type}' 
>> value='{@value}' maxlength='{@maxlength}' size='{@size}'/>
>>                   </td>
>>                 </tr>
>>               </xsl:if>
>>
>>               <!--      TYPE CHECK BOX     -->
>>
>>               <xsl:if test="$type='checkbox'">
>>                 <tr>
>>                   <td>
>>                     <b><xsl:value-of select='@display' /></b>
>>                   </td>
>>                   <td>
>>                     <xsl:variable name="checked" select="@checked" />
>>                     <xsl:if test="$checked='true'">
>>                       <input name='{@name}' type='{@type}' 
>> value='{@value}' checked='{@checked}' />
>>                     </xsl:if>
>>                     <xsl:if test="$checked='false'">
>>                       <input name='{@name}' type='{@type}' 
>> value='{@value}' />
>>                     </xsl:if>                   </td>
>>                 </tr>
>>               </xsl:if>
>>
>>               <!--      TYPE HIDDEN     -->
>>
>>               <xsl:if test="$type='hidden'">
>>                 <tr>
>>                   <td colspan='2'>
>>                     <input name='{@name}' type='{@type}' 
>> value='{@value}' />
>>                   </td>
>>                 </tr>
>>               </xsl:if>
>>
>>               <!--      TYPE SUBMIT   and TYPE CANCEL  -->
>>
>>               <xsl:if test="$type='submit'">
>>                 <tr>
>>                   <td align="right">
>>                     <input name='{@name}' type='{@type}' 
>> value='{@value}' />
>>
>> </td>
>>
>>                   <td align="left">
>>                     <input name='cancel' type='button' value='Cancel' 
>> onClick='javascript:history.back(1)' />                   </td>
>>                 </tr>
>>               </xsl:if>
>>
>>           </xsl:for-each>
>>         </table>
>>      </form>
>>    </xsl:template>
>>
>> These examples may not be perfect to your use but this is some kind
>> of sample and i guess this will help you.All the Best.
>>
>> -Anand
>>
>>
>>
>> -- 
>> To unsubscribe, e-mail:   
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail: 
>> <ma...@jakarta.apache.org>
>>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>
>



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


Re: xsl portlet.

Posted by Shan Gopalakrishnan <sg...@cisco.com>.
also Anand, where are u specifying the xml input to the xsl portlet.  I see 
the xsl file is mentioned.
      <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
hidden="false">  but how about the xml file?
probably i'm missing something.


At 12:27 PM 5/2/2002 +0530, anand wrote:
>Hai Shan,
>1.     This is how you you place your XSL in portels.xreg
>
><portlet-entry name="XSL" hidden="false" type="abstract" application="false">
>
><classname>org.apache.jetspeed.portal.portlets.ShanXSLPortlet</classname>
>        <parameter name="host" value="localhost" hidden="false"/>
>        <parameter name="port" value="8080" hidden="false"/>
>        <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
> hidden="false">
>            <security role="admin"/>
>        </parameter>
>    </portlet-entry>
>
>2.Say your vm/jsp will output a xml and this will be the input to
>   your xsl.This sample vm shows how to output the form.....
>
><shan>
>  <shan_form>
>    <action>/shan/portal/pane0/ShanPortal</action>
>    <method>post</method>
>    <onsubmit>return validate(this)</onsubmit>
>    <input type="text" name="searchstring" display="" value=""/>
>    <input type="submit" name="search" value="search" />
>    <input type="hidden" name="nodeId" value="$nodeId" />
>    <input type="hidden" name="userId" value="$userId" />
>  </shan_form>
></shan>
>
>3.If your vm is outputing in such a way then you can
>   use the below sample of xsl.....
>
><xsl:template match="shan/shan_form">
>      <form name="{name}" action="{action}" method="{method}" 
> onSubmit="{onsubmit}" enctype="{enctype}">
>         <table>
>          <xsl:for-each select="input">
>             <xsl:variable name="type" select="@type" />
>                <!--      TYPE AREA     -->
>                <xsl:if test="$type='area'">
>                 <tr>
>                 <td>                   <b><xsl:value-of select='@display' 
> /></b>
>                 </td>
>                 <td>
>                   <textarea name="{@name}" rows="{@rows}" cols="{@cols}">
>                     <xsl:for-each select="value">
>                       <xsl:value-of select="." />
>                     </xsl:for-each>
>                   </textarea>
>                 </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      DISPLAY     -->
>
>               <xsl:if test="$type='display'">
>                 <tr>
>                   <td>
>                     <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                      <xsl:value-of select='@value' />
>                   </td>
>                 </tr>
>               </xsl:if>
>
>
>               <!--      SELECT     -->
>
>               <xsl:if test="$type='select'">
>                 <tr>
>                   <td colspan='2'>
>                   <select name='{@name}' size='{@size}' 
> multiple="{@multiple}">
>                     <xsl:for-each select="option">
>                       <xsl:variable name ="selected" select="@selected" />
>                         <xsl:if test= "$selected = 'selected'">
>                           <option value ='{@value}' selected='{selected}'>
>                             <xsl:value-of select='@display' />
>                           </option>
>                         </xsl:if>
>                         <xsl:if test= "$selected = 'notselected'">
>                           <option value ='{@value}'>
>                             <xsl:value-of select='@display' />
>                           </option>
>                         </xsl:if>
>                     </xsl:for-each>
>                   </select>
>                   </td>
>                 </tr>
>               </xsl:if>
>
>
>               <!--     DROP DOWN     -->
>
>               <xsl:if test="$type='dropdown'">
>                 <tr>
>                 <td>                   <b><xsl:value-of select='@display' 
> /></b>
>                 </td>
>                 <td>
>                   <select name='{@name}' size='{@size}'>
>                     <xsl:for-each select="option">
>                       <xsl:variable name="type" select="@selected" />
>                         <xsl:if test="$type='true'">
>                           <option value='{@value}' selected='{@selected}'>
>                             <xsl:value-of select="." />
>                           </option>
>                         </xsl:if>
>                       <xsl:if test="$type='false'">
>                         <option value='{@value}'>
>                           <xsl:value-of select="." />
>                         </option>
>                       </xsl:if>                     </xsl:for-each>
>                   </select>
>                 </td>
>                 </tr>
>               </xsl:if>
>
>
>               <!--     TYPE FILE     -->
>
>
>               <xsl:if test="$type='file'">
>                  <tr>
>                  <td>
>                    <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                    <input name='{@name}' type='{@type}' value='{@value}' 
> />
>                  </td>
>                 </tr>
>               </xsl:if>
>               <xsl:if test="$type='text'">
>                 <tr>
>                   <td>
>                     <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                     <input name='{@name}' type='{@type}' value='{@value}' 
> maxlength='{@maxlength}' size='{@size}'/>
>                   </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      TYPE CHECK BOX     -->
>
>               <xsl:if test="$type='checkbox'">
>                 <tr>
>                   <td>
>                     <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                     <xsl:variable name="checked" select="@checked" />
>                     <xsl:if test="$checked='true'">
>                       <input name='{@name}' type='{@type}' 
> value='{@value}' checked='{@checked}' />
>                     </xsl:if>
>                     <xsl:if test="$checked='false'">
>                       <input name='{@name}' type='{@type}' 
> value='{@value}' />
>                     </xsl:if>                   </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      TYPE HIDDEN     -->
>
>               <xsl:if test="$type='hidden'">
>                 <tr>
>                   <td colspan='2'>
>                     <input name='{@name}' type='{@type}' value='{@value}' 
> />
>                   </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      TYPE SUBMIT   and TYPE CANCEL  -->
>
>               <xsl:if test="$type='submit'">
>                 <tr>
>                   <td align="right">
>                     <input name='{@name}' type='{@type}' value='{@value}' 
> />
>
></td> 
>
>
>                   <td align="left">
>                     <input name='cancel' type='button' value='Cancel' 
> onClick='javascript:history.back(1)' 
> />                   </td>
>                 </tr>
>               </xsl:if>
>
>           </xsl:for-each>
>         </table>
>      </form>
>    </xsl:template>
>
>These examples may not be perfect to your use but this is some kind
>of sample and i guess this will help you.All the Best.
>
>-Anand
>
>
>
>--
>To unsubscribe, 
>e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>


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


Re: xsl portlet.

Posted by Shan Gopalakrishnan <sg...@cisco.com>.
million thanks Anand.  made me curious to ask another question. what if my 
xml is returned by a object by a xml stream of string
how do i plug that.

At 12:27 PM 5/2/2002 +0530, anand wrote:
>Hai Shan,
>1.     This is how you you place your XSL in portels.xreg
>
><portlet-entry name="XSL" hidden="false" type="abstract" application="false">
>
><classname>org.apache.jetspeed.portal.portlets.ShanXSLPortlet</classname>
>        <parameter name="host" value="localhost" hidden="false"/>
>        <parameter name="port" value="8080" hidden="false"/>
>        <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
> hidden="false">
>            <security role="admin"/>
>        </parameter>
>    </portlet-entry>
>
>2.Say your vm/jsp will output a xml and this will be the input to
>   your xsl.This sample vm shows how to output the form.....
>
><shan>
>  <shan_form>
>    <action>/shan/portal/pane0/ShanPortal</action>
>    <method>post</method>
>    <onsubmit>return validate(this)</onsubmit>
>    <input type="text" name="searchstring" display="" value=""/>
>    <input type="submit" name="search" value="search" />
>    <input type="hidden" name="nodeId" value="$nodeId" />
>    <input type="hidden" name="userId" value="$userId" />
>  </shan_form>
></shan>
>
>3.If your vm is outputing in such a way then you can
>   use the below sample of xsl.....
>
><xsl:template match="shan/shan_form">
>      <form name="{name}" action="{action}" method="{method}" 
> onSubmit="{onsubmit}" enctype="{enctype}">
>         <table>
>          <xsl:for-each select="input">
>             <xsl:variable name="type" select="@type" />
>                <!--      TYPE AREA     -->
>                <xsl:if test="$type='area'">
>                 <tr>
>                 <td>                   <b><xsl:value-of select='@display' 
> /></b>
>                 </td>
>                 <td>
>                   <textarea name="{@name}" rows="{@rows}" cols="{@cols}">
>                     <xsl:for-each select="value">
>                       <xsl:value-of select="." />
>                     </xsl:for-each>
>                   </textarea>
>                 </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      DISPLAY     -->
>
>               <xsl:if test="$type='display'">
>                 <tr>
>                   <td>
>                     <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                      <xsl:value-of select='@value' />
>                   </td>
>                 </tr>
>               </xsl:if>
>
>
>               <!--      SELECT     -->
>
>               <xsl:if test="$type='select'">
>                 <tr>
>                   <td colspan='2'>
>                   <select name='{@name}' size='{@size}' 
> multiple="{@multiple}">
>                     <xsl:for-each select="option">
>                       <xsl:variable name ="selected" select="@selected" />
>                         <xsl:if test= "$selected = 'selected'">
>                           <option value ='{@value}' selected='{selected}'>
>                             <xsl:value-of select='@display' />
>                           </option>
>                         </xsl:if>
>                         <xsl:if test= "$selected = 'notselected'">
>                           <option value ='{@value}'>
>                             <xsl:value-of select='@display' />
>                           </option>
>                         </xsl:if>
>                     </xsl:for-each>
>                   </select>
>                   </td>
>                 </tr>
>               </xsl:if>
>
>
>               <!--     DROP DOWN     -->
>
>               <xsl:if test="$type='dropdown'">
>                 <tr>
>                 <td>                   <b><xsl:value-of select='@display' 
> /></b>
>                 </td>
>                 <td>
>                   <select name='{@name}' size='{@size}'>
>                     <xsl:for-each select="option">
>                       <xsl:variable name="type" select="@selected" />
>                         <xsl:if test="$type='true'">
>                           <option value='{@value}' selected='{@selected}'>
>                             <xsl:value-of select="." />
>                           </option>
>                         </xsl:if>
>                       <xsl:if test="$type='false'">
>                         <option value='{@value}'>
>                           <xsl:value-of select="." />
>                         </option>
>                       </xsl:if>                     </xsl:for-each>
>                   </select>
>                 </td>
>                 </tr>
>               </xsl:if>
>
>
>               <!--     TYPE FILE     -->
>
>
>               <xsl:if test="$type='file'">
>                  <tr>
>                  <td>
>                    <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                    <input name='{@name}' type='{@type}' value='{@value}' 
> />
>                  </td>
>                 </tr>
>               </xsl:if>
>               <xsl:if test="$type='text'">
>                 <tr>
>                   <td>
>                     <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                     <input name='{@name}' type='{@type}' value='{@value}' 
> maxlength='{@maxlength}' size='{@size}'/>
>                   </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      TYPE CHECK BOX     -->
>
>               <xsl:if test="$type='checkbox'">
>                 <tr>
>                   <td>
>                     <b><xsl:value-of select='@display' /></b>
>                   </td>
>                   <td>
>                     <xsl:variable name="checked" select="@checked" />
>                     <xsl:if test="$checked='true'">
>                       <input name='{@name}' type='{@type}' 
> value='{@value}' checked='{@checked}' />
>                     </xsl:if>
>                     <xsl:if test="$checked='false'">
>                       <input name='{@name}' type='{@type}' 
> value='{@value}' />
>                     </xsl:if>                   </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      TYPE HIDDEN     -->
>
>               <xsl:if test="$type='hidden'">
>                 <tr>
>                   <td colspan='2'>
>                     <input name='{@name}' type='{@type}' value='{@value}' 
> />
>                   </td>
>                 </tr>
>               </xsl:if>
>
>               <!--      TYPE SUBMIT   and TYPE CANCEL  -->
>
>               <xsl:if test="$type='submit'">
>                 <tr>
>                   <td align="right">
>                     <input name='{@name}' type='{@type}' value='{@value}' 
> />
>
></td> 
>
>
>                   <td align="left">
>                     <input name='cancel' type='button' value='Cancel' 
> onClick='javascript:history.back(1)' 
> />                   </td>
>                 </tr>
>               </xsl:if>
>
>           </xsl:for-each>
>         </table>
>      </form>
>    </xsl:template>
>
>These examples may not be perfect to your use but this is some kind
>of sample and i guess this will help you.All the Best.
>
>-Anand
>
>
>
>--
>To unsubscribe, 
>e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>


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


Re: xsl portlet.

Posted by anand <an...@eself.com>.
Hai Shan,
 1.     This is how you you place your XSL in portels.xreg

<portlet-entry name="XSL" hidden="false" type="abstract" 
application="false">
        
<classname>org.apache.jetspeed.portal.portlets.ShanXSLPortlet</classname>
        <parameter name="host" value="localhost" hidden="false"/>
        <parameter name="port" value="8080" hidden="false"/>
        <parameter name="stylesheetURL" value="/shan/xsl/shan.xsl" 
hidden="false">
            <security role="admin"/>
        </parameter>
    </portlet-entry>

2.Say your vm/jsp will output a xml and this will be the input to
   your xsl.This sample vm shows how to output the form.....

<shan>
  <shan_form>
    <action>/shan/portal/pane0/ShanPortal</action>
    <method>post</method>
    <onsubmit>return validate(this)</onsubmit>
    <input type="text" name="searchstring" display="" value=""/>
    <input type="submit" name="search" value="search" />
    <input type="hidden" name="nodeId" value="$nodeId" />
    <input type="hidden" name="userId" value="$userId" />
  </shan_form>      
</shan>

3.If your vm is outputing in such a way then you can
   use the below sample of xsl.....

<xsl:template match="shan/shan_form">
      <form name="{name}" action="{action}" method="{method}" 
onSubmit="{onsubmit}" enctype="{enctype}">
         <table>
          <xsl:for-each select="input">
             <xsl:variable name="type" select="@type" />
                <!--      TYPE AREA     -->
                <xsl:if test="$type='area'">               
                 <tr>
                 <td> 
                   <b><xsl:value-of select='@display' /></b>
                 </td>
                 <td>
                   <textarea name="{@name}" rows="{@rows}" cols="{@cols}">
                     <xsl:for-each select="value">
                       <xsl:value-of select="." />
                     </xsl:for-each>
                   </textarea>
                 </td>
                 </tr>
               </xsl:if>
              
               <!--      DISPLAY     -->
              
               <xsl:if test="$type='display'">
                 <tr>
                   <td>
                     <b><xsl:value-of select='@display' /></b>
                   </td>
                   <td>
                      <xsl:value-of select='@value' />
                   </td>
                 </tr>
               </xsl:if>
               

               <!--      SELECT     -->

               <xsl:if test="$type='select'">
                 <tr>
                   <td colspan='2'>
                   <select name='{@name}' size='{@size}' 
multiple="{@multiple}">
                     <xsl:for-each select="option">
                       <xsl:variable name ="selected" select="@selected" />
                         <xsl:if test= "$selected = 'selected'">
                           <option value ='{@value}' selected='{selected}'>
                             <xsl:value-of select='@display' />
                           </option>
                         </xsl:if>
                         <xsl:if test= "$selected = 'notselected'">
                           <option value ='{@value}'>
                             <xsl:value-of select='@display' />
                           </option>
                         </xsl:if>
                     </xsl:for-each>   
                   </select>
                   </td>
                 </tr>
               </xsl:if>
              

               <!--     DROP DOWN     -->

               <xsl:if test="$type='dropdown'">
                 <tr>
                 <td> 
                   <b><xsl:value-of select='@display' /></b>
                 </td>
                 <td>
                   <select name='{@name}' size='{@size}'>
                     <xsl:for-each select="option">
                       <xsl:variable name="type" select="@selected" />
                         <xsl:if test="$type='true'">
                           <option value='{@value}' selected='{@selected}'>
                             <xsl:value-of select="." />
                           </option>
                         </xsl:if>
                       <xsl:if test="$type='false'">
                         <option value='{@value}'>
                           <xsl:value-of select="." />
                         </option>
                       </xsl:if> 
                     </xsl:for-each>   
                   </select>
                 </td>
                 </tr>
               </xsl:if>

              
               <!--     TYPE FILE     -->
              

               <xsl:if test="$type='file'">
                  <tr>
                  <td>
                    <b><xsl:value-of select='@display' /></b>
                   </td>
                   <td>
                    <input name='{@name}' type='{@type}' 
value='{@value}' />      
                  </td>
                 </tr>
               </xsl:if>           
 
               <xsl:if test="$type='text'">
                 <tr>
                   <td>
                     <b><xsl:value-of select='@display' /></b>
                   </td>
                   <td>
                     <input name='{@name}' type='{@type}' 
value='{@value}' maxlength='{@maxlength}' size='{@size}'/>      
                   </td>
                 </tr>
               </xsl:if>
               
               <!--      TYPE CHECK BOX     -->
              
               <xsl:if test="$type='checkbox'">
                 <tr>
                   <td>
                     <b><xsl:value-of select='@display' /></b>
                   </td>
                   <td>
                     <xsl:variable name="checked" select="@checked" />
                     <xsl:if test="$checked='true'">
                       <input name='{@name}' type='{@type}' 
value='{@value}' checked='{@checked}' />      
                     </xsl:if>
                     <xsl:if test="$checked='false'">
                       <input name='{@name}' type='{@type}' 
value='{@value}' />      
                     </xsl:if> 
                   </td>
                 </tr>
               </xsl:if>              

               <!--      TYPE HIDDEN     -->
              
               <xsl:if test="$type='hidden'">
                 <tr>                  
                   <td colspan='2'>
                     <input name='{@name}' type='{@type}' 
value='{@value}' />      
                   </td>
                 </tr>
               </xsl:if>              

               <!--      TYPE SUBMIT   and TYPE CANCEL  -->
              
               <xsl:if test="$type='submit'">
                 <tr>
                   <td align="right">
                     <input name='{@name}' type='{@type}' 
value='{@value}' />                           
                   
</td>                                                                               

                   <td align="left">
                     <input name='cancel' type='button' value='Cancel' 
onClick='javascript:history.back(1)' /> 
                   </td>                  
                 </tr>
               </xsl:if>
              
           </xsl:for-each>
         </table>     
      </form>
    </xsl:template>

These examples may not be perfect to your use but this is some kind
of sample and i guess this will help you.All the Best.

-Anand



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