Following XSLT Logic Not Working

Please support our XML, XSLT and XPATH advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 1
Reputation: sanket002 is an unknown quantity at this point 
Solved Threads: 0
sanket002 sanket002 is offline Offline
Newbie Poster

Following XSLT Logic Not Working

 
0
  #1
31 Days Ago
I have to check value of a variable in XSLT if it is null then i have to set it to default "$"
so for that i have written following XSLT code:

<XSL:variable name dummy select= "ArrayOfBookMark/BookMark[ShortName='Asp-7041-EndVar1]/Value">
<XSL:choose>
<XSL:when test="($dummy!='')">
<XSL:variable name="dummy1" select="$dummy"/>
</when>
<XSL:otherwise>
<XSL:variable name="dummy1" select="'$'"/>
</XSL:variable>
<XSL:otherwise>
</XSL:choose>


Here in Dummy i am copying the value comming from follwing XML.it is retriving value correctly in to dummy.
Condition also checking but the value assignment code for new variable "dummy1" is not happening.

<ArrayOfBookMark>
<BookMark>
<ShortName>Asp-7041-EndVar1</ShortName>
<Value>12345</Value>
</BookMark>
</ArrayOfBookMark>

please help...


Quick response will b appriciated.

-Sanket
Sanket.chougule@gmail.com
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 95
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 5
fpmurphy fpmurphy is offline Offline
Junior Poster in Training
 
0
  #2
31 Days Ago
XML, XSLT and XPATH Syntax (Toggle Plain Text)
  1. <xsl:variable name="dummy" select= "/ArrayOfBookMark/BookMark[ShortName='Asp-7042-EndVar1']/Value" />
  2. <xsl:variable name="dummy1">
  3. <xsl:choose>
  4. <xsl:when test="$dummy != ''">$dummy</xsl:when>
  5. <xsl:otherwise>$</xsl:otherwise>
  6. </xsl:choose>
  7. </xsl:variable>
Reply With Quote Quick reply to this message  
Reply

Tags
xslt

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC