DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   XSL related question (http://www.daniweb.com/forums/thread149755.html)

anithajoe Oct 7th, 2008 11:31 am
XSL related question
 
Hi I wasn't sure as to where I need to post XSL related questions..Is there anyone in this group who has expertise with XSL? If anyone can help me out with an XSL related question, that would be great.

Ani

dickersonka Oct 7th, 2008 11:48 am
Re: XSL related question
 
Take a look at this for dynamic variable names with xsl.

http://bytes.com/forum/thread758105.html

anithajoe Oct 7th, 2008 12:22 pm
Re: XSL related question
 
In the code below I am just writing a simple for loop in XSL...Instead of creating a dynamic variable name, I have created a variable called sublink1 and later give a dynamic value to it based on loop variable's current value...Later construct a link with "sublink1"..Concept works fine without the for-each..I mean it generated only one link rather than 2 links...But when i give for-each, it doesn't display either of the links...

XML file:
<item>
<count>one</count>
<sub>2</sub> /*this tells the XSL file as to how many sublinks are listed..I
have used that for running the for loop*/
<sublink1>http://www.yahoo.com</sublink1>
<subtitle1>Yahoo</subtitle1>
<sublink2>http:www.google.com</sublink2>
<subtitle2>Google</subtitile2>

</item>

XSL file:

<div id="sublinklist" align="left" class="anylinkcss" style="width: 70.5px; background-color: black">
<xsl:for-each select="$sub">
<xsl:variable name="sublink1">
<xsl:value-of select="concat('sublink',$sub)"/>
</xsl:variable>
<xsl:variable name="subtitle1" select="subtitle1"/>
<a href="{sublink1}">
<xsl:value-of select="subtitle1"/>
</a>
</xsl:for-each>
</div>

Any suggestions?

Ani
Quote:

Originally Posted by dickersonka (Post 707237)
Take a look at this for dynamic variable names with xsl.

http://bytes.com/forum/thread758105.html



All times are GMT -4. The time now is 5:12 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC