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: Getting desired node on template match


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


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