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

RE: relatively new to XSL- variable setting question

Subject: RE: relatively new to XSL- variable setting question
From: "Bruce Rojas-Rennke" <brr@xxxxxxx>
Date: Mon, 6 Oct 2003 16:46:48 -0600
xsl variable setting
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..
tanx-
flashlight

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Bruce
Rojas-Rennke
Sent: Monday, October 06, 2003 4:27 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  relatively new to XSL- variable setting question


Happy monday,

  In my XSL template, I am selecting all DataRows, and then wanting to
output the value of ColData when it's colID='5'. No problem. But I want to
set the value of variable 'testVar' based upon whether or not the Datarow
has a colID='5'.

  I had hoped to set the variable default as '99999999', and then..
if the Datarow does contain a colID='5', set that same variable to equal
it's value instead.

With below code, I am getting..
  <input type="hidden" name="dateValue" value="optionA">
  -regardless if the DataRow has a colID='5' or not.
In other words, I am not getting the testVar value set within the
xsl:for-each tags. Which I guess is to be expected, from my reading, but I
can't see a workaround at this junction.


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 &#183; Operating Account (new)" />
  <ColData colID="8" value="Bill Pmt -Check" />
  <ColData colID="9" value="3241-1064422268" />
</DataRow>

thanks one and all,
flashlight


 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

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.