Subject: RE: [xsl] relatively new to XSL- variable setting question From: "Bruce Rojas-Rennke" <brr@xxxxxxx> Date: Mon, 6 Oct 2003 17:24:11 -0600 |
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: [xsl] 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 >XSL code..............(simplified to focus on dateVar problem) ><td> > <xsl:variable name="testVar" select="'optionA'"/> > <xsl:for-each select="ColData"> > <xsl:if test="@colID='5'"> > <xsl:value-of select="@value"/> > <xsl:variable name="testVar" select="'optionB'"/> > </xsl:if> > </xsl:for-each> > <input type="hidden" name="varPass" value="{$testVar}"/> ></td> > >XML input............. ><DataRow rowNumber="2"> > <ColData colID="2" value="2003-10-03" /> > <ColData colID="3" value="Bank One VISA (pay minimum)" /> > <ColData colID="4" value="-100.00" /> > <ColData colID="6" value="1010 · Operating Account (new)" /> > <ColData colID="8" value="Bill Pmt -Check" /> > <ColData colID="9" value="3241-1064422268" /> ></DataRow> ====================================================================== 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] relatively new to XSL- va, Wendell Piez | Thread | RE: [xsl] relatively new to XSL- va, Wendell Piez |
RE: [xsl] relatively new to XSL- va, Wendell Piez | Date | [xsl] Good Subject Lines, Mulberry Technologie |
Month |