Re: [xsl] <go> element needs to be nested

Subject: Re: [xsl] <go> element needs to be nested
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Tue, 16 Apr 2002 17:47:05 -0400
Assuming that the "href" is the "action" attribute of the form element (you
haven't made this clear), this should do it:

 <xsl:template match="form">
       <xsl:apply-templates select="input" >
            <!-- Capture the link value for later use -->
            <xsl:with-param name='href' select='@action'/>
    </xsl:apply-templates>
  </xsl:template>

<!-- Unchanged from your post -->
 <xsl:template match="input">
   <input>
     <xsl:copy-of select="@name | @size | @maxlength" />
   </input>
 </xsl:template>

<xsl:template match="input[@type = 'submit']">
    <!-- Recover the link value using the parameter -->
    <xsl:param name='href'/>
   <do type="accept" label="{normalize-space(@value)}">
        <!-- Just add your "go" element -->
        <go href='{$href}'/>
    </do>
 </xsl:template>

Otherwise, you will have to explain where the href value is supposed to come
from.

Cheers,

Tom P

[Jacob P. Glenn]

> I am using the XSLT below to transform an XHTML form to a wml form.  The
> problem with this is that it neglects the href.
>
> <xsl:template match="form">
>   <xsl:apply-templates select="input" />
>  </xsl:template>
>
> <xsl:template match="input">
>   <input>
>     <xsl:copy-of select="@name | @size | @maxlength" />
>   </input>
> </xsl:template>
>
> <xsl:template match="input[@type = 'submit']">
>   <do type="accept" label="{normalize-space(@value)}"/>
> </xsl:template>
>
>
> The proper wml input would be as follows:
>
> <input name="" size="" maxlength=""/>
> <do type="accept" label="">
> <go href=""/>
> </do>
>
>
> I don't know how to put the <go> element into the transformation.  I
> believe that it would have to be inside of the <do> element.  I don't
> know how to do this without getting a parser error.  Any suggestions?
>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread