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

RE: genarate key using a variable

Subject: RE: genarate key using a variable
From: Mukul Gandhi <mukulw3@xxxxxxxxx>
Date: Mon, 1 Sep 2003 02:31:23 -0700 (PDT)
transmission numbers
You mean the number of columns C1, C2 etc. are not
fixed and they may change over time. But still they
must be in limits. I guess, initially the number of
columns may be 6 or 7. So you can have 6 or 7 xsl:key
definitions in XSLT. When any new column is
introduced, you can add the corresponding xsl:key
definition. 

With this solution, you will need to maintain the
XSLT. But I guess it will solve the problem with
reasonable simplicity.. 

Regards,
Mukul

--- aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx wrote:
> Thank you David & Mukund. But my problem is bit
> tricky... 
> I have an xml like the below. & I have to filter the
> based any of attributes's  value. That is the user
> can specify that which of the columns' data he wud
> like to filter based of any that column's values.
> Something like excel sheet data filter. So that's
> where exactly I am stuck as I unable to figure out
> how to have both the attribute & its value as
> parameter.
> Also, the numbers of Columns C1, C2 etc are not
> limited
> 
> <?xml version="1.0"?>
> 
> <PickList>
> 	<TotalRows>33</TotalRows>
> 	<Columns C1="Deposit" C2="Period" C3="Status"
> C4="Value Date" C5="Maturity Date" C6="Deposit No"/>
> 	<Tags>ctlMskDepositNo *</Tags>
> 	<Rows>
> 		<Row C1="1" C2="1" C3="Closed Today"
> C4="23/10/2003" C5="23/04/2004" C6="1"/>
> 		<Row C1="2" C2="1" C3="Open Today" C4="06/11/2003"
> C5="05/01/2004" C6="2"/>
> 		<Row C1="3" C2="1" C3="Open Today" C4="29/02/2004"
> C5="29/04/2004" C6="3"/>
> 		<Row C1="7" C2="1" C3="Matured" C4="29/02/2004"
> C5="29/04/2004" C6="7"/>
> 		<Row C1="8" C2="1" C3="Closed" C4="29/02/2004"
> C5="29/04/2004" C6="8"/>
> 		<Row C1="9" C2="1" C3="Closed" C4="29/02/2004"
> C5="29/04/2004" C6="9"/>
> 		<Row C1="10" C2="1" C3=" Matured" C4="29/02/2004"
> C5="29/04/2004" C6="10"/>
> 		<Row C1="11" C2="1" C3="Open Today"
> C4="29/02/2004" C5="19/04/2004" C6="11"/>
> 		<Row C1="16" C2="1" C3="Open Today"
> C4="29/02/2004" C5="29/04/2004" C6="16"/>
> 		<Row C1="17" C2="1" C3="Open Today"
> C4="29/02/2004" C5="29/04/2004" C6="17"/>
> 		<Row C1="18" C2="1" C3="Open Today"
> C4="29/02/2004" C5="29/04/2004" C6="18"/>
> 		<Row C1="19" C2="1" C3="Closed" C4="29/02/2004"
> C5="19/04/2004" C6="19"/>
> 		<Row C1="32" C2="1" C3="Open Today"
> C4="29/02/2004" C5="09/04/2004" C6="32"/>
> 		<Row C1="33" C2="1" C3="Open Today"
> C4="29/02/2004" C5="30/03/2004" C6="33"/>
> 	</Rows>
> </PickList>
> Regards,
> aruniima
> 
>  -----Original Message-----
> From: 	M. David Peterson
> [mailto:conners_dad@xxxxxxx] 
> Sent:	Monday, September 01, 2003 1:56 PM
> To:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:	Re:  genarate key using a variable
> 
> I forgot that I needed to send this message in plain
> text format.  If the 
> other one gets through I apologize for the repeat
> mail...
> 
> Original text of my email....
> 
> Hey Aruniima,
> 
> You've stumbled upon one that puzzled me for awhile.
>  But I finally came up 
> with a quick and easy workaround.  Im sure there are
> others but this one is 
> simple and it works which are my number one rules of
> coding.
> 
> My assumption is that the number of choices the user
> has as far as node 
> names is fairly limited (e.g. Deposits, Withdrawls,
> etc...) and as such it 
> should be a quick and easy task for the xsl:choose
> element...
> 
> heres the xml file...
> 
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl"
> href="transactions.xslt" ?>
> <transactions>
>     <deposits>
>         <deposit id="001">25.00</deposit>
>         <deposit id="002">25.00</deposit>
>         <deposit id="003">35.00</deposit>
>         <deposit id="004">10.00</deposit>
>         <deposit id="005">12.00</deposit>
>         <deposit id="006">25.00</deposit>
>         <deposit id="007">25.00</deposit>
>     </deposits>
>     <withdrawals>
>         <withdrawal id="001">5.00</withdrawal>
>         <withdrawal id="002">2.00</withdrawal>
>         <withdrawal id="003">5.00</withdrawal>
>         <withdrawal id="004">10.00</withdrawal>
>         <withdrawal id="005">12.00</withdrawal>
>         <withdrawal id="006">250.00</withdrawal>
>         <withdrawal id="007">250.00</withdrawal>
>     </withdrawals>
> </transactions>
> 
> 
> 
> and heres the related xslt file named
> transactions.xslt....  just change the 
> variables accordingly
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
>      
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
> 
> <xsl:variable name="var_1">deposit</xsl:variable>
> <xsl:variable name="var_2">25.00</xsl:variable>
> <xsl:key name="varMatch_Deposit" match="//deposit"
> use="."/>
> <xsl:key name="varMatch_Withdrawal"
> match="//withdrawal" use="."/>
> 
>     <xsl:template match="/">
> 
>     <xsl:choose>
>         <xsl:when test="$var_1 = 'deposit'">
> 
>             <xsl:for-each
> select="key('varMatch_Deposit', $var_2)">
> 
>                 Deposit ID: <xsl:value-of
> select="@id"/><br/>
>                 Amount: <xsl:value-of
> select="."/><br/><br/><hr/>
> 
>             </xsl:for-each>
> 
>         </xsl:when>
>         <xsl:when test="$var_1 = 'withdrawal'">
> 
>             <xsl:for-each
> select="key('varMatch_Withdrawal', $var_2)">
> 
>                 Other ID: <xsl:value-of
> select="@id"/><br/>
>                 Other Amount: <xsl:value-of
> select="."/><br/><br/><hr/>
> 
>             </xsl:for-each>
> 
>         </xsl:when>
>         <xsl:otherwise>
> 
>             //code for otherwise
> 
>         </xsl:otherwise>
>     </xsl:choose>
> 
>     </xsl:template>
> </xsl:stylesheet>
> 
> 
> Hope this helps.
> 
> Best of luck!
> 
> M.David
> 
> 
> 
> 
> ----- Original Message ----- 
> From: <aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Monday, September 01, 2003 12:16 AM
> Subject:  genarate key using a variable
> 
> 
> > Hi All,
> > Is it possible to generate a xsl:key using a
> variable ?
> > As in  xsl:key element it does not allow me to use
> a variable in either 
> > match or use attribute. So is there any other way
> to do the same...
> >
> > e.g.
> > I want to search for all Rows with attribute say
> "@Deposit = 1"
> > where I receive both the attribute & the attribute
> value as parameters 
> > from the user.
> >
> >
> >
> > Regards,
> > aruniima
> >
> >
> >
> > DISCLAIMER:
> > This message contains privileged and confidential
> information and is 
> > intended only for the individual named.If you are
> not the intended 
> > recipient you should not
> disseminate,distribute,store,print, copy or 
> > deliver this message.Please notify the sender
> immediately by e-mail if you 
> > have received this e-mail by mistake and delete
> this e-mail from your 
> > system.E-mail transmission cannot be guaranteed to
> be secure or error-free 
> > as information could be
> intercepted,corrupted,lost,destroyed,arrive late 
> > or incomplete or contain viruses.The sender
> therefore does not accept 
> > liability for any errors or omissions in the
> contents of this message 
> > which arise as a result of e-mail transmission. If
> verification is 
> > required please request a hard-copy version.
> >
> >  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> >
> > 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
> 
> DISCLAIMER:
> This message contains privileged and confidential
> information and is intended only for the individual
> named.If you are not the intended recipient you
> should not disseminate,distribute,store,print, copy
> or deliver this message.Please notify the sender
> immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your
> system.E-mail transmission cannot be guaranteed to
> be secure or error-free as information could be
> intercepted,corrupted,lost,destroyed,arrive late or
> incomplete or contain viruses.The sender therefore
> does not accept liability for any errors or
> omissions in the contents of this message which
> arise as a result of e-mail transmission. If
> verification is required please request a hard-copy
> version.
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

 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.