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:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to