This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE: Re: Getting desired node on template match


Hello James
I do not know whether it is a FAQ or not but as u have asked for the solution then here it is . may be there can be better solution than this but it is what i have done .

<xsl:when test="@type='submit'">
<xsl:choose>
<xsl:when test="not(ancestor::form[1]/@method) or ancestor::form[1]/@method='GET'">
<do type ="accept" label="{@value}">
<xsl:variable name="url" select="ancestor::form[1]/@action"/>
<go href="http://someurl?url={$url}"; method="get">
<xsl:for-each select="ancestor::form[1]//input">
<xsl:if test="@type='text' or @type='password' or @type='checkbox'">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
<xsl:if test="@type='hidden'">
<postfield name="{@name}" value="{@value}"/>
</xsl:if>
<xsl:if test="not(@type)">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
<xsl:if test="@type='radio' and count( . | key('rad', @name)[1] ) = 1">
<postfield name="{@name}" value="$({@name})" />
</xsl:if>
</xsl:for-each>
</go>
</do>
</xsl:when>

<xsl:when test="ancestor::form[1]/@method='POST'">
<do type ="accept" label="{@value}">
<xsl:variable name="url" select="ancestor::form[1]/@action"/>
<go href="http://someurl?url={$url}"; method="post">
<xsl:for-each select="ancestor::form[1]//input">
<xsl:if test="@type='text' or @type='password' or @type='checkbox'">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
<xsl:if test="@type='hidden'">
<postfield name="{@name}" value="{@value}"/>
</xsl:if>
<xsl:if test="not(@type)">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
<xsl:if test="@type='radio' and count( . | key('rad', @name)[1] ) = 1">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
</xsl:for-each>
</go>
</do>
</xsl:when>
<xsl:otherwise>
<do type ="accept" label="submit">
<xsl:variable name="url" select="ancestor::form[1]/@action"/>
<go href="http://someurl?url={$url}"; method="{ancestor::form[1]/@method}">
<xsl:for-each select="ancestor::form[1]//input">
<xsl:if test="@type='text' or @type='password' or @type='checkbox'">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
<xsl:if test="@type='hidden'">
<postfield name="{@name}" value="{@value}"/>
</xsl:if>
<xsl:if test="not(@type)">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
<xsl:if test="@type='radio' and count( . | key('rad', @name)[1] ) = 1">
<postfield name="{@name}" value="$({@name})"/>
</xsl:if>
</xsl:for-each>
</go>
</do>



I really felt nice when i solved it my self and believe me i did not wanted u people to solve the whole problem and provide the full code as i am not in favour of spoon feeding.
I hope u will read it.
and i know if there is any better solution you must tell me.
Thanks
alex







On Sat, 21 Sep 2002 James Fuller wrote :
> I have solved my problem my self . It took a whole day but now i
> have solved it and it is working fine. It took a lot of reading
> but at the end i felt that you have not given answer . and it was
> beneficial for me as i tried a little more .
> Thanks for writing something like
>
> >Did you actually write anything of the rest of the code you
> >posted?
>
>
> as it made me to do something and prove to you that i can do
> something may be not as knowledgable as u but a little bit can
> do.

I think whenever there is a call for more information, or perhaps comment,
its an honest attempt at
solving a problem ( or directing the person to the correct resource, in your
case a book / faq ); and if u ask for help ( at least when I do )...dont
expect it in the form you want it....

so now that you have answered your question why don't you share your
solution ( and prove that it aint so FAQ ) so all of us can benefit ? or
maybe you have unsubscribed from this surly list ?

cheers, jim fuller


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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]