[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: RE: Re: Getting desired node on template match
From: "alex ek" <alexek@xxxxxxxxxxxxxx>
Date: 23 Sep 2002 14:58:55 -0000
xsl if test 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.