You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by John Small Berries <jo...@gmail.com> on 2004/10/06 10:46:18 UTC

empty attribute string using xslt with request parameters

Having a problem getting this to work.  This works and my output
document has a form with action="blah".  To get this, in xslt I have a
template like so:
<xsl:template match="form[@action='redisplay']">
  <form method="post" name="theform" action="blah">
    <xsl:apply-templates/>
  </form>
</xsl:template>

The resulting tag looks like <form method="post" action="blah" name="theform">

However, this doesn't work:
<xsl:template match="form[@action='redisplay']">
  <form method="post" name="theform" action={$contId}>
    <xsl:apply-templates/>
  </form>
</xsl:template>

The resulting tag looks like <form action="" name="theform" method="post">

I have declared this at the top of my .xsl sheet:
<xsl:param name="contId"/>

In my sitemap, I have request parameters turned on (there are others
defined that work for other situations in the same .xsl document.)

For background, I am trying to dynamically update a xml template
document with continuation id gotten from flowscript.  In my
flowscript I send the string continuation.id with my sendPageAndWait
function as a parameter--along with three others.  The others have
values that I access easily all over my .xsl file.  I've even tried
setting explicit dummy test strings for this one parameter.  Nothing
shows up.  This one appears to be an empty string, or something else
is going on that I'm not doing right.  Suggestions?

One other thing, when Cocoon outputs my final html, the form is in the
order of action, method, name.  But all my xml files, and xslt have
name, method, action order.  Is there some bug messing up the
transformation?

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


Re: empty attribute string using xslt with request parameters

Posted by John Small Berries <jo...@gmail.com>.
One other thing.  Everytime I send a message to this list, I get this
reply, but the message goes to the list still.

---------
Please be advised that the correct e-mail address format to be used in
all correspondence with Standard Bank is:

recipient'sfirstname.recipient'ssurname@standardbank.co.za

While your e-mail has been delivered to the intended recipient, please
change your records accordingly.

Technology Engineering
Standard Bank
----------
The mailing list address is users@cocoon.apache.org right?

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


Re: empty attribute string using xslt with request parameters

Posted by John Small Berries <jo...@gmail.com>.
On Wed, 06 Oct 2004 18:23:33 +0200, Jorg Heymans <jh...@domek.be> wrote:
> post the sitemap snippet where you're calling the stylesheet. Is it
> embedded in an action?
No actions,  the portion of the sitemap looks like this:
      <map:match pattern="merge">
        <map:generate type="stream">
          <map:parameter name="form-name" value="xml"/>
        </map:generate>
        <map:transform src="cocoon:/transformxml"/>
        <map:transform type="xslt" src="style/newrendercss.xsl">
          <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>    
        <map:transform type="xinclude"/> 
        <map:transform type="xslt" src="style/finalrendercss.xsl">
          <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>       
        <map:serialize type="html"/>

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


Re: empty attribute string using xslt with request parameters

Posted by Jorg Heymans <jh...@domek.be>.
post the sitemap snippet where you're calling the stylesheet. Is it 
embedded in an action?

John Small Berries wrote:
> On Wed, 06 Oct 2004 11:42:00 +0200, Andreas Hartmann <an...@apache.org> wrote:
> 
>>John Small Berries wrote:
>>
>>>Having a problem getting this to work.  This works and my output
>>>document has a form with action="blah".  To get this, in xslt I have a
>>>template like so:
>>><xsl:template match="form[@action='redisplay']">
>>>  <form method="post" name="theform" action="blah">
>>>    <xsl:apply-templates/>
>>>  </form>
>>></xsl:template>
>>>
>>>The resulting tag looks like <form method="post" action="blah" name="theform">
>>>
>>>However, this doesn't work:
>>><xsl:template match="form[@action='redisplay']">
>>>  <form method="post" name="theform" action={$contId}>
>>
>>I guess you mean
>>
>>    <form method="post" name="theform" action="{$contId}">
> 
> Oops, yeah, that's what I have, without quotes was a typo.
> 
>>>    <xsl:apply-templates/>
>>>  </form>
>>></xsl:template>
>>>
>>>The resulting tag looks like <form action="" name="theform" method="post">
>>>
>>>I have declared this at the top of my .xsl sheet:
>>><xsl:param name="contId"/>
>>
>>Did you try
>>
>><xsl:param name="contId" select="'blah'"/>
>>
>>to see if the error happens on passing the parameter?
> 
> When I try to do what you suggest above, the output is still <form
> action=""....>
> Btw, if I pass in a literal it works in the stylesheet, so I know I'm
> matching, which
> I guess I'd know anyways b/c the action is going from ="redisplay" to "".
> 
>>[...]
>>
>>
>>>One other thing, when Cocoon outputs my final html, the form is in the
>>>order of action, method, name.  But all my xml files, and xslt have
>>>name, method, action order.  Is there some bug messing up the
>>>transformation?
>>
>>IIRC, the XML spec says that attribute order does not matter at all.
>>So it's up to the transformer to choose an attribute order, it's not
>>a bug.
> 
> Ok, just wanted to cross that off the list of possible things I was doing wrong.
> 
>>-- Andreas
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>


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


Re: empty attribute string using xslt with request parameters

Posted by John Small Berries <jo...@gmail.com>.
On Wed, 06 Oct 2004 21:20:51 +0200, Andreas Hartmann <an...@apache.org> wrote:
> John Small Berries wrote:
> > On Wed, 06 Oct 2004 11:42:00 +0200, Andreas Hartmann <an...@apache.org> wrote:
> >
> >>John Small Berries wrote:
> 
> [...]
> 
> >><xsl:param name="contId" select="'blah'"/>
> >>
> >>to see if the error happens on passing the parameter?
> >
> > When I try to do what you suggest above, the output is still <form
> > action=""....>
> > Btw, if I pass in a literal it works in the stylesheet, so I know I'm
> > matching, which
> > I guess I'd know anyways b/c the action is going from ="redisplay" to "".
> 
> This is very strange. Did you check your stylesheet with an
> XSLT tool, e.g. Oxygen? Maybe you could attach it?
> It looks very much like an XSLT issue.
No, I didn't check it.  What I'm actually assuming is something is
wrong in my flowscript.  I ended up doing a workaround by submitting
the $continuation.id as a hidden form field.  Then the xslt was able
to get it.  I don't know where my logic was wrong earlier, but I
couldn't see anything.  It seems I _must_ have been passing an empty
string to the parameter somehow.
> 
> BTW, which Cocoon version are you using? And is it the interpreted
> Xalan, XSLTC, or any other processor?
Using Cocoon 2.1.5.1 and whatever the default is.  I didn't change anything.
> 
> 
> 
> -- Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

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


Re: empty attribute string using xslt with request parameters

Posted by Andreas Hartmann <an...@apache.org>.
John Small Berries wrote:
> On Wed, 06 Oct 2004 11:42:00 +0200, Andreas Hartmann <an...@apache.org> wrote:
> 
>>John Small Berries wrote:

[...]

>><xsl:param name="contId" select="'blah'"/>
>>
>>to see if the error happens on passing the parameter?
> 
> When I try to do what you suggest above, the output is still <form
> action=""....>
> Btw, if I pass in a literal it works in the stylesheet, so I know I'm
> matching, which
> I guess I'd know anyways b/c the action is going from ="redisplay" to "".

This is very strange. Did you check your stylesheet with an
XSLT tool, e.g. Oxygen? Maybe you could attach it?
It looks very much like an XSLT issue.

BTW, which Cocoon version are you using? And is it the interpreted
Xalan, XSLTC, or any other processor?

-- Andreas


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


Re: empty attribute string using xslt with request parameters

Posted by John Small Berries <jo...@gmail.com>.
On Wed, 06 Oct 2004 11:42:00 +0200, Andreas Hartmann <an...@apache.org> wrote:
> John Small Berries wrote:
> > Having a problem getting this to work.  This works and my output
> > document has a form with action="blah".  To get this, in xslt I have a
> > template like so:
> > <xsl:template match="form[@action='redisplay']">
> >   <form method="post" name="theform" action="blah">
> >     <xsl:apply-templates/>
> >   </form>
> > </xsl:template>
> >
> > The resulting tag looks like <form method="post" action="blah" name="theform">
> >
> > However, this doesn't work:
> > <xsl:template match="form[@action='redisplay']">
> >   <form method="post" name="theform" action={$contId}>
> 
> I guess you mean
> 
>     <form method="post" name="theform" action="{$contId}">
Oops, yeah, that's what I have, without quotes was a typo.
> 
> >     <xsl:apply-templates/>
> >   </form>
> > </xsl:template>
> >
> > The resulting tag looks like <form action="" name="theform" method="post">
> >
> > I have declared this at the top of my .xsl sheet:
> > <xsl:param name="contId"/>
> 
> Did you try
> 
> <xsl:param name="contId" select="'blah'"/>
> 
> to see if the error happens on passing the parameter?
When I try to do what you suggest above, the output is still <form
action=""....>
Btw, if I pass in a literal it works in the stylesheet, so I know I'm
matching, which
I guess I'd know anyways b/c the action is going from ="redisplay" to "".
> 
> [...]
> 
> > One other thing, when Cocoon outputs my final html, the form is in the
> > order of action, method, name.  But all my xml files, and xslt have
> > name, method, action order.  Is there some bug messing up the
> > transformation?
> 
> IIRC, the XML spec says that attribute order does not matter at all.
> So it's up to the transformer to choose an attribute order, it's not
> a bug.
Ok, just wanted to cross that off the list of possible things I was doing wrong.
> 
> -- Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

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


Re: empty attribute string using xslt with request parameters

Posted by Jorg Heymans <jh...@domek.be>.

John Small Berries wrote:
> On Wed, 06 Oct 2004 18:35:21 +0200, Jorg Heymans <jh...@domek.be> wrote:
> 
>>
>>John Small Berries wrote:
>>
>>>Just for reference, I'm trying to get the continuation id out of my
>>>flowscript with
>>>var contId = cocoon.continuation.id;
>>>cocoon.sendPageAndWait("aPage", {"contId": contId});
>>

Rethinking this, cocoon.sendPageAndWait("aPage", {"contId": contId}) 
creates a CONTEXT object called contId, not a request parameter. You can 
use the ContextInputModule to access context objects, i couldn't find an 
example sorry. Have a look at 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/session/components/ContextInputModule.html 
and post your findings.

HTH
Jorg


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


Re: empty attribute string using xslt with request parameters

Posted by John Small Berries <jo...@gmail.com>.
On Wed, 06 Oct 2004 18:35:21 +0200, Jorg Heymans <jh...@domek.be> wrote:
> 
> 
> John Small Berries wrote:
> > Just for reference, I'm trying to get the continuation id out of my
> > flowscript with
> > var contId = cocoon.continuation.id;
> > cocoon.sendPageAndWait("aPage", {"contId": contId});
> 
> That looks correct yes
> 
> But if your stylesheet has access to the request params and the
> continuation is passed as a hidden var (using the <ft:continuation-id />
> construct), can't you just access the var "continuation-id" then?

Just for some more information, I have three other params sent with my
flowscript.  In my stylesheet, they work when I try to set the form
action to their value.  However, even when I hardcode contId = "test"
in my flowscript, and then send it, it still does not properly get
substituted.  Why would three params work and one not if they're all
coming from the same place?

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


Re: empty attribute string using xslt with request parameters

Posted by John Small Berries <jo...@gmail.com>.
On Wed, 06 Oct 2004 18:35:21 +0200, Jorg Heymans <jh...@domek.be> wrote:
> 
> 
> John Small Berries wrote:
> > Just for reference, I'm trying to get the continuation id out of my
> > flowscript with
> > var contId = cocoon.continuation.id;
> > cocoon.sendPageAndWait("aPage", {"contId": contId});
> 
> That looks correct yes
> 
> But if your stylesheet has access to the request params and the
> continuation is passed as a hidden var (using the <ft:continuation-id />
> construct), can't you just access the var "continuation-id" then?
I'm not aware of the above hidden variable or construct.  Can I just
directly use "continuation-id" variable in my stylesheets?  Are there
any declarations I have to make to be able to use it in my stylesheet?

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

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


Re: empty attribute string using xslt with request parameters

Posted by Jorg Heymans <jh...@domek.be>.

John Small Berries wrote:
> Just for reference, I'm trying to get the continuation id out of my
> flowscript with
> var contId = cocoon.continuation.id;
> cocoon.sendPageAndWait("aPage", {"contId": contId});

That looks correct yes

But if your stylesheet has access to the request params and the 
continuation is passed as a hidden var (using the <ft:continuation-id /> 
construct), can't you just access the var "continuation-id" then?


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


Re: empty attribute string using xslt with request parameters

Posted by John Small Berries <jo...@gmail.com>.
Just for reference, I'm trying to get the continuation id out of my
flowscript with
var contId = cocoon.continuation.id;
cocoon.sendPageAndWait("aPage", {"contId": contId});

This is the right way to send the continuation id in the request right?

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


Re: empty attribute string using xslt with request parameters

Posted by Andreas Hartmann <an...@apache.org>.
John Small Berries wrote:
> Having a problem getting this to work.  This works and my output
> document has a form with action="blah".  To get this, in xslt I have a
> template like so:
> <xsl:template match="form[@action='redisplay']">
>   <form method="post" name="theform" action="blah">
>     <xsl:apply-templates/>
>   </form>
> </xsl:template>
> 
> The resulting tag looks like <form method="post" action="blah" name="theform">
> 
> However, this doesn't work:
> <xsl:template match="form[@action='redisplay']">
>   <form method="post" name="theform" action={$contId}>

I guess you mean

    <form method="post" name="theform" action="{$contId}">


>     <xsl:apply-templates/>
>   </form>
> </xsl:template>
> 
> The resulting tag looks like <form action="" name="theform" method="post">
> 
> I have declared this at the top of my .xsl sheet:
> <xsl:param name="contId"/>

Did you try

<xsl:param name="contId" select="'blah'"/>

to see if the error happens on passing the parameter?

[...]

> One other thing, when Cocoon outputs my final html, the form is in the
> order of action, method, name.  But all my xml files, and xslt have
> name, method, action order.  Is there some bug messing up the
> transformation?

IIRC, the XML spec says that attribute order does not matter at all.
So it's up to the transformer to choose an attribute order, it's not
a bug.

-- Andreas


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