cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <andrewm...@gmail.com>
Subject Re: Problem with XSL xtransformation...PLEASE HELP!!!
Date Thu, 20 Jul 2006 13:58:31 GMT
Right!,
it seems I have found the culprit which is causing me so much headache:

<jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"
/>

In the simple form example at
http://cocoon.apache.org/2.1/userdocs/basics/sample.html

the following is said, and I quote:

'The CForms-specific elements here are in the "Forms Template" namespace: *
ft*.

First, jx:import is used to import the CForms macros which execute the
elements in the ft namespace.

The <ft:widget-label> tag will cause the label of a widget to be inserted at
the location of the tag. The <ft:widget> tag will cause the XML
representation of a widget to be inserted at the location of that tag. The
inserted XML will be in the "Forms Instance" namespace: *fi*.
The XML representation of the widget will then be translated to HTML by an
XSLT stylesheet'

Where my xsl stylesheets are situated in the pipe this is definately not
happening! If I swap the stylesheets around, then the form section is
transfored correctly but the page design is completely broken:

                <map:transform type="i18n">
                  <map:parameter name="locale" value="en-US"/>
                </map:transform>
                <map:transform src="template-style/forms-samples-styling.xsl
"/>
                <map:transform type="i18n">
                  <map:parameter name="locale" value="en-US"/>
                </map:transform>

               ------ This section has been placed after
forms-samples-styling.xsl  --------

                <map:transform type="cinclude"/>
                <map:transform type="xslt-saxon" src="style/{2}.xsl"/>
                <map:transform type="cinclude"/>

So what gives with this? Suffice to say, I completely confused by this one,
so any help with this will be graciously welcomed!!

regards

Andrew
On 20/07/06, Andrew <andrewmadu@gmail.com> wrote:
>
> Hi,
> why is this, as well as other sections in forms-field-styling.xsl being
> ignored during transformation?:
>
>   <!--+
>       | fi:form-template|fi:form-generated
>       +-->
>   <xsl:template match="fi:form-template|fi:form-generated">
>     <form>
>       <xsl:copy-of select="@*"/>
>       <xsl:choose>
>         <xsl:when test="@ajax = 'true'">
>           <xsl:attribute name="dojoType">CFormsForm</xsl:attribute>
>           <xsl:if test="@ajax = 'true'">
>             <script type="text/javascript">cocoon.forms.ajax =
> true;</script>
>           </xsl:if>
>         </xsl:when>
>         <xsl:otherwise>
>           <xsl:attribute name="onsubmit">forms_onsubmit(); <xsl:value-of
> select="@onsubmit"/></xsl:attribute>
>         </xsl:otherwise>
>       </xsl:choose>
>       <!-- hidden field to store the submit id -->
>       <div><input type="hidden" name="forms_submit_id"/></div>
>       <xsl:apply-templates/>
>
>       <!-- TODO: consider putting this in the xml stream from the
> generator? -->
>       <xsl:if test="self::fi:form-generated">
>         <input type="submit"/>
>       </xsl:if>
>     </form>
>   </xsl:template>
>
>
> regards
>
> Andrew
>
> On 20/07/06, Andrew <andrewmadu@gmail.com > wrote:
> >
> > Ok Guys,
> >
> > I have just had a look informs-field-styling.xsl and seen that the
> > convention for form-template is <fi:form-template /> and not
> > <ft:form-template /> ! SO why in the doc examples do you see
> > ft:form-template? Which one is correct? When I use fi for all form elements,
> > none of them are transformed and the html output is:
> >
> > <form-template action="login.kont" name="Form1" method= "POST" ajax=
> > "true">
> > <continuation-id />
> > <div id="output">
> > <table border ="0" cellspacing="0" cellpadding= "0">
> > <tr>
> > <td width="55" valign="bottom"><img src="images/user.gif" width="55"
> > height="16" /></ td>
> > <td width="220" valign= "top">
> > <group>
> > <styling type="tabs" />
> > <state>
> > </state>
> > <items>
> > <widget id="username">
> >
> > <styling size="30" type="text" class="keyinbox" />
> > </
> > widget>
> >
> > </items>
> > </group>
> > </td>
> > </tr>
> > </ table>
> >
> > but when I use ft for certain form elements, the html output is:
> >
> > <form-template action= "login.kont" ajax="true" name="Form1" method=
> > "POST">
> > <continuation-id>2a3a7b7c4d375249848a141a70702c45462d6333</
> > continuation-id>
> > <div id="output">
> > <table border="0" cellspacing="0" cellpadding= "0">
> > <tr>
> > <td width="55" valign="bottom"><img src="images/user.gif" width="55"
> > height="16" /></ td>
> > <td width="220" valign= "top">
> > <group>
> > <styling type="tabs" />
> > <state>
> > <field id="activetab" state="active" required="false"><datatype type="integer"
> > />
> > </field>
> > </state>
> > < items>
> > <field id="username" state= "active" required="true"><datatype type="string"
> > />
> > <styling size="30" type="text" class="keyinbox" />
> > </ field>
> > </group>
> > </td>
> > </tr>
> > </table>
> >
> > Can someone PLEASE let me know what is going on here?
> >
> > regards
> >
> > Andrew
> >
> > On 20/07/06, Andrew < andrewmadu@gmail.com> wrote:
> > >
> > > Hi,
> > > I am having problems understanding why I am getting html output as
> > > follows:
> > >
> > >         <form-template
> > >  action="login.kont" ajax="true" name=
> > > "Form1" method="POST">
> > >         <continuation-id>5885482d2522194f47888e4f4269021f22172563</
> > > continuation-id>
> > >
> > >         <table border=
> > > "0" cellspacing="0" cellpadding="0">
> > >
> > > 	<tr>
> > > 	<td width="55"
> > >
> > > valign
> > > ="bottom"><img src="images/user.gif"
> > > width="55" height="16" /></
> > > td>
> > > 	<td width="220" valign=
> > > "top">
> > > 	<group>
> > > 	<styling type="tabs"
> > > />
> > > 	<state>
> > > 	<field id="activetab"
> > > state="active" required="false">
> > >             <datatype
> > >  type="integer" />
> > >
> > >
> > >         </field>
> > >         </
> > > state>
> > > 	<items>
> > > 	  <field id="username"
> > > state="active" required="true">
> > >             <datatype
> > >  type="string" />
> > >           <
> > >
> > > styling
> > >  size="30" type="text" class=
> > > "keyinbox" />
> > > 	  </field>
> > >         </items>
> > > 	</group>
> > >
> > > 	</td>
> > > 	</tr></
> > >
> > > table>
> > >
> > > As you can see, the form and widgets are not being rendered properly at all,
why is this?
> > >
> > >
> > > My sitemap is as follows:
> > >
> > > <map:match pattern="**viewform-*">
> > > <map:generate type="jx" src="jx/{2}.jx"/>
> > >
> > >
> > > <map:transform type="browser-update"/>
> > >
> > > <map:transform type="cinclude"/>
> > > <map:transform type="xslt-saxon" src="style/{2}.xsl"/>
> > > <map:transform type="cinclude"/>
> > > <map:transform type="i18n">
> > >
> > >
> > >
> > > <map:parameter name="locale" value="en-US"/>
> > > </map:transform>
> > > <map:transform src="template-style/forms-samples-styling.xsl"/>
> > > <map:transform type="i18n">
> > >
> > >
> > >
> > > <map:parameter name="locale" value="en-US"/>
> > > </map:transform>
> > > <map:select type="ajax-request">
> > > <map:when test="true">
> > > <map:serialize type="xml"/>
> > >
> > >
> > >
> > > </map:when>
> > > <map:otherwise>
> > > <map:serialize type="xhtml"/>
> > > </map:otherwise>
> > > </map:select>
> > > </map:match>
> > >
> > >
> > > jx/{2}.jx is:
> > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > >
> > > <page
> > > xmlns:jx="
> > >
> > > http://apache.org/cocoon/templates/jx/1.0"
> > >
> > > xmlns:cinclude="http://apache.org/cocoon/include/1.0
> > >
> > > "
> > > xmlns:ft="http://apache.org/cocoon/forms/1.0#template
> > > "
> > > xmlns:fi="
> > >
> > > http://apache.org/cocoon/forms/1.0#instance">
> > >
> > > <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-
> > >
> > >
> > > macros.xml" />
> > > 	<login_fields>
> > > 		<jx:choose>
> > > 		  <jx:when test="${userGlobal==null}">
> > > 		  	<ft:form-template action="login.kont" name="Form1" method="POST" ajax="true">
> > >
> > >
> > >
> > > 				<ft:continuation-id />
> > > 				   <div id="output">
> > > 					<table border="0" cellspacing="0" cellpadding="0">
> > > 						<tr>
> > > 						  <td width="55" valign="bottom"><img src="images/user.gif"
width="55" height="16" /></td>
> > >
> > >
> > >
> > > 						  <td width="220" valign="top">
> > > 							<fi:group>
> > > 						  		<fi:styling type="tabs" />
> > > 						  			<fi:state>
> > > 									  	<ft:widget id="activetab" />
> > >
> > >
> > >
> > > 						  			</fi:state>
> > > 						  			<fi:items>
> > > 									  	<ft:widget id="username">
> > > 									  		<fi:styling size="30" type="text" class="keyinbox" />
> > >
> > >
> > >
> > > 									  	</ft:widget>
> > > 						  			</fi:items>
> > > 					    	</fi:group>
> > > 						  </td>
> > > 						</tr>
> > > 					  </table>
> > > 					  <table border="0" cellspacing="0" cellpadding="0">
> > >
> > >
> > >
> > > 						<tr>
> > > 						  <td width="55" valign="bottom"><img src="images/passwords.gif"
width="89" height="16" /></td>
> > > 						  <td width="220" valign="top">
> > >
> > >
> > >
> > > 							<fi:group>
> > > 						  		<fi:styling type="tabs" />
> > > 						  			<fi:state>
> > > 									  	<ft:widget id="activetab" />
> > > 						  			</fi:state>
> > > 						  			<fi:items>
> > >
> > >
> > >
> > > 									  	<ft:widget id="password">
> > > 									  		<fi:styling size="30" type="password" class="keyinbox" />
> > > 									  	</ft:widget>
> > > 						  			</fi:items>
> > >
> > >
> > >
> > > 				    		</fi:group>
> > > 						  </td>
> > > 						</tr>
> > > 					  </table>
> > > 					  <table border="0" cellspacing="0" cellpadding="0">
> > > 						<tr>
> > >
> > >
> > >
> > > 						  <td colspan="6" align="right"><img src="images/tool.gif" width="2"
border="0" height="5" /></td>
> > > 						</tr>
> > > 						<tr>
> > >
> > >
> > >
> > > 						  <td><img src="images/tool.gif" width="3" border="0" height="1"
/></td>
> > > 						  <td width="55" valign="bottom" class="indextext"><img src="
> > >
> > >
> > > captcha.jpeg" /></td>
> > > 						  <td width="220" valign="top">
> > > 						  	<table border="0" cellspacing="0" cellpadding="0">
> > > 						  	<tr>
> > >
> > >
> > >
> > > 						  		<td><img src="images/tool.gif" width="3" border="0" height="1"
/></td>
> > > 							  	<td valign="top">
> > > 									<fi:group>
> > >
> > >
> > >
> > > 								  		<fi:styling type="tabs" />
> > > 								  			<fi:state>
> > > 											  	<ft:widget id="activetab" />
> > > 								  			</fi:state>
> > > 								  			<fi:items>
> > >
> > >
> > > 											  	<ft:widget id="captcha_code">
> > >
> > > 											  		<fi:styling listbox-size="30" type="text" class="keyinbox"
/>
> > > 											  	</ft:widget>
> > > 								  			</fi:items>
> > >
> > >
> > > 						    		</fi:group>
> > >
> > > 							  	</td>
> > > 						  	</tr>
> > > 						  	</table>
> > > 						  </td>
> > > 						</tr>
> > > 					  </table>				
> > > 					  <table width="100%" border="0" cellspacing="0" cellpadding="0">
> > >
> > >
> > >
> > > 						<tr>
> > > 						  <td colspan="6" align="right"><img src="images/tool.gif" width="2"
border="0" height="10" /></td>
> > > 						</tr>
> > >
> > >
> > >
> > > 						<tr>
> > > 						  <td align="right">
> > > 						  <table width="100%" cellpadding="0" cellspacing="0" border="0">
> > > 						  <tr>
> > >
> > > 						  	<td align="left" valign="bottom" class="indextext"><a href="javascript:popup('
> > >
> > > sendDetailsPopUp.xml','${userGlobal}')">&#160;Forgotten your Password?</a></td>
> > >
> > > 						  	<td align="right"><img src="images/plus.gif" width="8" height="14"
/></td>
> > >
> > >
> > > 						  </tr>
> > > 						  </table>
> > > 						  </td>
> > >
> > > 						  <td width="8" align="left"><img src="images/plus.gif" width="8"
height="14" /></td>
> > >
> > >
> > > 						  <td width="42" align="left"><a href="javascript:formSubmit(
> > > document.Form1)" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('sumit','','images/sumit-
> > >
> > > over.gif',1)"><img src="images/sumit-none.gif" alt="sumit" name="sumit"
width="42" height="15" border="0" /></a></td>
> > >
> > > 						  <td width="42" align="center" valign="middle"><a href="javascript:formReset(
> > >
> > > document.Form1)" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('cancel','','images/cancel-
> > > over.gif',1)"><img src="images/cancel-none.gif" alt="cancel" name="cancel"
width="42" height="15" border="0" /></a></td>
> > >
> > >
> > > 						  <td width="20" align="center" valign="middle"><img src="images/tool.gif"
width="20" height="8" /></td>
> > >
> > > 						</tr>
> > >
> > > 					  </table>
> > >
> > > 				</div>
> > > 			  </ft:form-template>
> > > 			</jx:when>
> > > 			<jx:otherwise>
> > >                         ..... more code here ........
> > > 			</jx:otherwise>
> > > 		</jx:choose>
> > >
> > >
> > > 	</login_fields>
> > >
> > >
> > > style/{2}.xsl is:
> > >
> > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > 	<xsl:stylesheet version="1.0"
> > > 		xmlns:xsl="
> > >
> > > http://www.w3.org/1999/XSL/Transform
> > > "
> > > 		xmlns:cinclude="http://apache.org/cocoon/include/1.0
> > >
> > > "
> > > 		xmlns:fi="http://apache.org/cocoon/forms/1.0#instance
> > > "
> > >
> > > 		xmlns:ft="
> > > http://apache.org/cocoon/forms/1.0#template"
> > > 		exclude-result-prefixes="ft fi cinclude">
> > >
> > >
> > > 		<xsl:template match="/">
> > >
> > > 		<page>
> > > 		  <html>
> > > 				<head>
> > >
> > > 				</head>
> > > 				
> > > 			<body leftmargin="0" marginheight="0" topmargin="0" marginwidth="0" onload="InitialiseScrollableArea();preloadImages('images/scroller_up_on.gif','images/scroller_down_on.gif');MM_swapImage('images/sumit-
> > >
> > >
> > > over.gif','images/cancel-over.gif','images/emaillink-over.gif')">
> > > 			<table width="261" border="0" cellspacing="0" cellpadding="0">
> > > 				  ... more code .....
> > >
> > >
> > >
> > >                                    <tr>
> > > 					<td><xsl:apply-templates select="//login_fields"/></td>
> > > 				  </tr>
> > > 				</table></td>
> > > 			   ...... more code ......
> > >
> > >
> > >
> > > </body>
> > > </html>
> > > </page>
> > > </xsl:template>
> > >
> > > <xsl:template match="login_fields">
> > > 	<xsl:apply-templates/>
> > > </xsl:template>
> > >
> > > <xsl:template match="*">
> > >
> > >
> > >
> > > 	  <xsl:element name="{local-name()}">
> > > 			<xsl:apply-templates select="@*|xmlns|node()"/>
> > > 	  </xsl:element>
> > > </xsl:template>
> > >
> > > <xsl:template match="@*|text()">
> > >
> > >
> > >
> > > 	  <xsl:copy/>
> > > </xsl:template>
> > > 	
> > > 		
> > > </xsl:stylesheet>
> > >
> > > regards
> > >
> > > Andrew
> > >
> > >
> >
>

Mime
View raw message