Re: [xsl] How do I convert the use of onclick in HTML to work in XSLT?

Subject: Re: [xsl] How do I convert the use of onclick in HTML to work in XSLT?
From: "Jon Gorman" <jonathan.gorman@xxxxxxxxx>
Date: Wed, 8 Mar 2006 16:16:53 -0600
On 3/8/06, Shirley Gasch <sgasch@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Thanks for replying Michael. I still don't know
> what to do to achieve the result that I want.
> What can add to the XSLT that I have below (in
> the form) to make sure that the resultant page
> comes up in the right-hand frame???

You don't have XSLT in a form.  The XSLT creates the form that will be
used.  This might sound like I'm being picky, but I'm really not.  The
concepts are different and treating them the same will cause issues.

Look at the guidelines for this list (mailed to you when you joined)
and it suggests providing the source for the transformation as well as
the expected output (and perhaps the current output that is wrong that
you are getting now).   This is necessary since often we end up giving
wrong advice because we're forced to guess part of the process.

In other words, for a source you have ???, I'm not really sure.  Is it
an XML file?  Are you calling the Filemaker process directly on some
data?

But lets look at what you want...

Assuming it's static and your output type is html in the style sheet, to get

<TD ALIGN=center id=srch abbr="Search for a CMR">
            <P><INPUT TYPE=button NAME=SearchSyLg VALUE="Search  CMRs
"
onclick="window.top.b.location.href='FMPro?-db=WebWaivers.fp5&-lay=Normal&-fo
rmat=WaiverSearch.htm&-view';return
true;"></P>
         </TD>

in the result html just have it in the XSLT at an appropriate place in
the templates.  You'll have to escape those & (by using & amp ;
without the spaces).

Of course, since you're cleaning it up you could target xhtml as an
output format (not sure if the following would be valid xhtml), so

<td align="center" id="srch" abbr="Search for a CMR">
            <p><input type="button" name="SearchSyLg" value="Search  CMRs
"
onclick="window.top.b.location.href='FMPro?-db=WebWaivers.fp5&amp;-lay=Normal
&-format=WaiverSearch.htm&amp;-view';return
true;"></p>
         </td>

Of course, if you're typing this out the long way, you can do
<xsl:element name="form">
<xsl:attribute name="'method'"> select="'post'">
 <xsl:attribute name="'name'">SearchforCMR</xsl:attribute>
<xsl:attribute name="action">waiversearch.xsl</xsl:attribute>

....

and so on.

Here, like the other cases, you are creating an element that will be
in your output xml and defining attributes.  It doesn't have any magic
knowledge of this is an "action" attribute or that the element is a
form attribute.  It just knows you told it to create an element in the
output called form with a list of attributes.

Of course, if these forms aren't static but should be generated from
the XML, you'll actually have to show us the XML in order for us to
guess what should be happening.

A rough and poor analogy to your question: I need to get to New York,
New York.  What do to my train to make it behave like New York?

We responded with the question: Where are you starting from? A train
is just a way to get to point A to point B.  If you want something
that behaves like New York, go to New York.

A stylesheet just takes some input and produces an output, the same
way a train just goes from point A to point B.  Tell us where you're
coming from, where you mistakenly end, the route you attempted, and
the end destination you want and we might be able to help you pick the
right train.  (Just to carry this analogy further.  Really, give us
the source xml, the stylesheet, the actual output, the desired output.
 And of course trim it up a little so just the relevant bits for the
problem at hand for each step are shown)


Jon Gorman

Current Thread