This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Plse Help! something to do with counter....
- To: mail at jenitennison dot com
- Subject: Re: [xsl] Plse Help! something to do with counter....
- From: "Poh Justin KT" <nitsujpoh at hotmail dot com>
- Date: Wed, 02 May 2001 17:50:45 +0800
- Cc: xsl-list at lists dot mulberrytech dot com
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi, Thanks! It instead solve much of my problems but if I want to omit any
one of the Resource element, for e.g I don't want to have a checkbox for the
3rd element but I still want to display other values of this element, and at
the same time the value attribute of the checkbox will still be in
consecutive numbers. position() don't seem to be able to work this way...
Sorry, if I didn't explain clearly. Thanks for your help!
>From: Jeni Tennison <mail@jenitennison.com>
>Reply-To: Jeni Tennison <mail@jenitennison.com>
>To: "Poh Justin KT" <nitsujpoh@hotmail.com>
>CC: xsl-list@lists.mulberrytech.com
>Subject: Re: [xsl] Plse Help! something to do with counter....
>Date: Wed, 2 May 2001 09:49:07 +0100
>
>Hi Justin,
>
> > Thanks for your reply. I tried to change the codes to fit into my
> > XSL but failed. This is my XSL..
>
>Ah... I'm sorry - I misinterpreted your question. Thanks for posting
>more details.
>
>So, you want to have a different input element for each Resource; each
>Resource has an Index child which gives the name for the checkbox, and
>you want each to have a distinct value.
>
>That's actually a lot easier. Just apply templates to the Resource
>elements:
>
><xsl:template match="/">
> <html>
> <body>
> <form method="GET" action="../servlet/takeLoan">
> <xsl:apply-templates select="List/Resource" />
> </form>
> </body>
> </html>
></xsl:template>
>
>Now, the processor takes that set of Resource elements and sorts them
>into a list (in document order) that it will process, called the
>current node list. You can have a template that matches the Resource
>element to provide you with the output that you want for each of them.
>Within this template, you can use position() to get the position of
>the particular Resource element you're currently processing (the
>current node) within the current node list. And you can use that to
>get the incrementing values that you want:
>
><xsl:template match="Resource">
> <div align="right">
> <input type="checkbox" name="{Index}" value="c{position()}" />
> </div>
> <br />
></xsl:template>
>
>I hope that helps,
>
>Jeni
>
>---
>Jeni Tennison
>http://www.jenitennison.com/
>
>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list