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

Re: Re: Getting desired node on template match

Subject: Re: Re: Getting desired node on template match
From: "alex ek" <alexek@xxxxxxxxxxxxxx>
Date: 11 Sep 2002 14:40:37 -0000
href get
Yes you are right that putting some random code would not work.
But please do not get angry.
In my next post I have written that that was posted by mistake.
Actually I have written simply href="action" (hardcoded) and it was printing action in output. Then I changed it to @action and it was outputting nothing. Then I was thinking if any thing of that sort can be written and you can say I should have tried it first on paper and I have written that on code directly .
When I read my post on list I realised that what I have posted so I have send another post.
I have a XSL book from WROX PRESS and I have read some chapters on www.jenitennison.com.
As I have mentioned that for grouping I have taken directly from the
http://www.jenitennison.com/xslt/grouping/muenchian.xml
and put it in my code and It is working but I did not understand exactly what it is doing
count(. | key('contacts-by-surname', surname)[1]) = 1
So I asked if you could explain me that.


And the problem was that same code is working for input type text and password and checkbox but not for input type ='' and hidden.

html is
<form action="some.href" method="get">Login<input type="text"
name="name" /><br />
Password<input type="password" name="password" /><br />
<input type="checkbox" name="checkbox1" value="" />India<br />
<input type="checkbox" name="checkbox2" value="" />Canada<br/>
<input type="checkbox" name="checkbox3" value="" />England<br/>
<input type="submit" value="Save Preferences" name="submit"
/></form>


<form action="/search" name="f">
<table cellspacing="0" cellpadding="0">
<tr>
<td width="75"></td>
<td align="center">
<input type="hidden" name="hl" value="en" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="hidden" name="oe" value="UTF-8" />
<input maxlength="256" size="55" name="q" value="" /><br />
<input type="submit" value="Google Search" name="btnG" />
<input type="submit" value="I'm Feeling Lucky" name="btnI"
/></td>
<td valign="top" nowrap="nowrap"><font size="-2">
<a href="/advanced_search?hl=en">AdvancedSearch</a><br />
<a href="/preferences?hl=en">Preferences</a><br />
<a href="/language_tools?hl=en">Language Tools</a></font> </td>
</tr>
</table>
</form>


here is my xsl


<xsl:template match="input[@type='submit']">
<do type ="accept" label="submit">
<go href="action"> <!--HERE I ACTUALLY
WANT TO TAKE THE VALUE OF ACTION ATTRIBUTE OF FORM FOR HREF AND
METHOD FROM METHOD OF FORM -->
<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'"> <!-- initially i had put
every condition (type=hidden ,type='')in one that is above but
that was giving error so i tried to write it -->
<postfield name="{@name}" value="${@name}"/>
</xsl:if>
<xsl:if test="not(@type)"> <!-- this is for if type is
not given as in google then take it as type = text so name value
pair for that -->
<postfield name="{@name}" value="${@name}" />
</xsl:if>
</xsl:for-each>
</go>
</do>
</xsl:template>



the output it is giving (WML) this is just a portion <do type="accept" label="submit"> <go href="action"> <postfield name="name" value="$name"/> <postfield name="password" value="$password"/> <postfield name="checkbox1" value="$checkbox1"/> <postfield name="checkbox2" value="$checkbox2"/> <postfield name="checkbox3" value="$checkbox3"/> </go> </do>

<do type="accept" label="submit">
<go href="action"/> here postfield should have come
</do>
<do type="accept" label="submit">
<go href="action"/>here postfield should have come
</do>



I hope you would not get angry .
alexek





On Mon, 09 Sep 2002 J.Pietschmann wrote :
alex ek wrote:
<xsl:template match="input[@type='submit']">
<do type ="accept" label="submit">
<go href="ancestor::form[1][{@action}]"> <!--HERE I ACTUALLY WANT TO TAKE THE VALUE OF ACTION ATTRIBUTE OF FORM FOR HREF AND METHOD FROM METHOD OF FORM (initially tried for action only)BUT NOT GETTING HOW TO RETRIVE THAT -->

Putting some random stuff into a file and then shouting around because it doesn't do what you think it should do is a very inefficient way to solve problems. Get a good book about XSLT. The XSLT FAQ has a few pointers. Perhaps buy Jeni Tennison's "Beginning XSLT" (ISBN 1861005946) and take a week or two to work through it. You'll be much more effective afterwards.

J.Pietschmann



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.