RE: relatively new to XSL- variable setting question
Hello Wendell, You're right, I was trying to simplify my code for testing and took a wrong shortcut and so your code does indeed work, and put me closer to my goal. My problem has one last twist, as my real code below will show. I have an XSL for-each element involved, and so have to allow for RowData nodes, as some will have a ColData element = 5, and some RowData nodes don't ... Thanks again for your help, that code is eloquent, very cool. at any rate here's my real code in case it's of interest to any one else.. <xsl:choose> <xsl:when test="ColData/@colID='5'"> <xsl:call-template name="dateTime2"> <xsl:with-param name="dateBit2" select="ColData[@colID='5']/@value"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <input type="hidden" name="dateDue" value="99999999"/> </xsl:otherwise> </xsl:choose> chao, flashlight -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Wendell Piez Sent: Tuesday, October 07, 2003 9:05 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: relatively new to XSL- variable setting question Bruce, Sorry, I'm missing a bit of context: can you show us the code with this erroneous result? plus a sample of what you want it to be? My first suggestion only concerns the variable declaration; how it is used depends on you. The second suggestion should not (cannot) result in the output you are showing. Perhaps you are using an xsl:value-of statement instead of the xsl:copy-of I suggested? That would give you the wrong results.... Cheers, Wendell At 07:24 PM 10/6/2003, you wrote: >Thanks Wendell, > > I tried below suggestion, but getting output like.. ><td> > <input type="hidden" name="varPass" value="99999">schite ></td> > >instead of.. ><td> > <input type="hidden" name="varPass" value="schite"> ></td> > > >?? >- flashlight > > >-----Original Message----- >From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Wendell Piez >Sent: Monday, October 06, 2003 5:00 PM >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; xsl-list@xxxxxxxxxxxxxxxxxxxxxx >Subject: RE: relatively new to XSL- variable setting question > > >Bruce, > >At 06:46 PM 10/6/2003, Bruce you wrote: > >Replying to my own post... a simpler way to ask my question is: > >- is there a way to test if an element contains a given node > >(ColData[@colID='5']? -- then I can make my variable statement conditional > >instead of it's value, as one can't reset a variables value in XSL > >apparently.. > >You're on the right track: > ><xsl:variable name="testVar"> > <xsl:choose> > <xsl:test if="@colID=5"> > <xsl:value-of select="@value"/> > </xsl:test> > <xsl:otherwise>99999</xsl:otherwise> > </xsl:choose> ></xsl:variable> > >Or sometimes there are more concise ways to achieve the behavior you want: > ><input type="hidden" name="varPass" value="99999"> > <xsl:copy-of select="@value[current()/@colID=5]"/> ></input> > >No variable needed -- value defaults to 99999 unless your colID is 5, in >which case @value is copied. > >Cheers, >Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format