You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrew <an...@gmail.com> on 2006/07/20 12:41:04 UTC

Problem with XSL xtransformation...PLEASE HELP!!!

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

Re: Re: Problem with XSL xtransformation...PLEASE HELP!!!

Posted by Andrew <an...@gmail.com>.
Bertrand,
many thanks for your help,

>
> <xsl:template match="@*|node()">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
> </xsl:template>


your solution worked a treat

you might be more successful with very specific
> subject lines and "as concise as possible" questions instead


Point taken.  So the more experienced I become, the  more concise my
questions. Don't you just love experience! ;-)

regards

Andrew

Re: Re: Problem with XSL xtransformation...PLEASE HELP!!!

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 7/20/06, Andrew <an...@gmail.com> wrote:

> ...So,  how do I stop all fi: tags from being stripped out in the first
> stylesheet (style/{2}.xsl)?...

You have to explicitely copy them, something like

<xsl:template match="fi:*">
  <xsl:copy>
    ...usual identity copy stuff

Or, if it doesn't conflict with other templates

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

-Bertrand

P.S. shouting PLEASE HELP in the subject line tends to slow down the
flow of replies - you might be more successful with very specific
subject lines and "as concise as possible" questions instead

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problem with XSL xtransformation...PLEASE HELP!!!

Posted by Andrew <an...@gmail.com>.
Eureka!!!

What is happening is that when my jx page hits my stylesheet, style/{2}.xsl,
all the fi: parts of the tags are stripped out!!! So we go from:

<fi:form-template action="login.kont" ajax="true" name="Form1"
method="POST">
<fi:continuation-id>3e1d50522826841983526b05063d32576c1f1e5e</fi:continuation-id>
−
    <fi:group>
<fi:styling type="tabs"/>
−
    <fi:state>
−
    <fi:field id="activetab" state="active" required="false">
.....

to here:

<form-template action="login.kont" ajax="true" name="Form1" method="POST">
<continuation-id>3e1d50522826841983526b05063d32576c1f1e5e</continuation-id>
−
    <group>
<styling type="tabs"/>
−
    <state>
−
    <field id="activetab" state="active" required="false">
......

and of course by the time this xml hits forms-samples-styling.xsl what we
are left with is nonsense!!!!

So,  how do I stop all fi: tags from being stripped out in the first
stylesheet (style/{2}.xsl)?

Once again my pipe snippet is:

                <map:generate type="newjx" 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:transform src="template-style/forms-samples-styling.xsl
"/>
                <map:transform type="i18n" />

regards

Andrew

On 20/07/06, Andrew <an...@gmail.com> wrote:
>
> 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 <an...@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
> > > >
> > > >
> > >
> >
>

Re: Problem with XSL xtransformation...PLEASE HELP!!!

Posted by Andrew <an...@gmail.com>.
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 <an...@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
> > >
> > >
> >
>

Re: Problem with XSL xtransformation...PLEASE HELP!!!

Posted by Andrew <an...@gmail.com>.
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 <an...@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 <an...@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
> >
> >
>

Re: Problem with XSL xtransformation...PLEASE HELP!!!

Posted by Andrew <an...@gmail.com>.
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 <an...@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
>
>