[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Re: for-each not working


Subject: Re: [xsl] Re: for-each not working
From: Mukul Gandhi <mukulw3@xxxxxxxxx>
Date: Tue, 15 Jul 2003 09:28:17 -0700 (PDT)

Please try this..

<xsl:for-each select="restrictedValue">
  <xsl:if test="(position() = 1) and text()">
    Min Value Allowed: <xsl:value-of select="text()"
/>
  </xsl:if>
  <xsl:if test="(position() = 1) and not(text())">
    Min Value Allowed: None
  </xsl:if>
  <xsl:if test="(position() = 2) and text()">
    Max Value Allowed: <xsl:value-of select="text()"
/>
  </xsl:if>	   
  <xsl:if test="(position() = 2) and not(text())">
    Max Value Allowed: None
  </xsl:if>	   
</xsl:for-each>


Regards,
Mukul


--- John Liebermann <ahsan_hussain@xxxxxxxxxxxxx>
wrote:
> Hi All--
> 
> How do i compare the contents of a tag to an empty
> string? I thought i could
> invoke this call and be able to process the contents
> of each
> <restrictedValue> tag separately. But that is not
> the case. A "for-each
> snippet" works for me but i am not able to put "Min
> Value Allowed: 40" like
> this or "Max Value Allowed: None". They both have to
> placed before the
> "for-each" statement. Below you will find how i want
> the output to be
> displayed. This is how i was tryin to solve this
> problem:
> 
> XSL (faulty):
> 
> Once inside the template:
> 
> Min Value Allowed: <br />
> Max Value Allowe: <br />
> <xsl:when test="contains(@restrictType, '2')">
> 	<xsl:for-each select="restrictedValue">
> 		<xsl:value-of select="text()" /><br/>
> 	</xsl:for-each><br /><br />
> </xsl:when>
> 
> But this doesn't solve my problem.
>
--------------------------------------------------------------------------
> Here is the XML snippet:
> 
> <HSContract>
> 	<HSDataContainerType name="TextValueRestrictions"
> required="true"
> revision="">
> 		<HSString name="restrictByRangeNoMAX"
> required="true" restrictType="2"
> xmlNodeType="1">
> 			<restrictedValue>40</restrictedValue>
> 			<restrictedValue />
> 		</HSString>
> </HSContract>
> 
> Here is how i want the output (HTML) to look like:
> 
> Min Value Allowed: 40
> Max Value Allowed: None
> 
> The first <restrictedValue>40</restrictedValue> will
> always be the minimum
> whereas the next one will be the max. I want to see
> if there is nothing
> inside any one of these tags, i would like to put
> "None" after Max Value
> Allowed or Min Value Allowed.
> 
> If you are confused as to what i want, please email
> me so that i can try to
> explain better.
> 
> Any help will be greatly appreciated. Thank you.
> 
> -John
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords