Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl transform, change div ID dynamically

Status
Not open for further replies.

bont

Programmer
Sep 7, 2000
200
US
I have XSL template, which I am using a for-each loop.

I would like to do the following:

Code:
<DIV ID="<xsl:value-of select="PLAYINGSEASON"/>&#32;<xsl:value-of select="YEAR"/>">
....
</DIV>

As you can see, doing it this way, calling xsl tag within div tab doesn't work. I'm sure there is an easy way to do this, but I have not been able to find a simple reference for this.

F.Y.I. I am using dynamic divs to have hidden / visible / clickable layers. It works well with standard HTML, and I am now trying it i combo with xsl.
 
<DIV>
<xsl:attribute name="ID">
<xsl:text>PLAYINGSEASON&#32;</xsl:text><xsl:value-of select="YEAR"/>
</xsl:attribute>
<!-- <whatever> -->
</DIV>
 
Thank you all for you aid. This eventually worked for me:

Code:
<DIV ID="{TRIMESTER}_{YEAR}_{WEEKNUMBER}_H">

Your suggestion; however, has served a purpose, to show me some of the basic I don't know (sorry, teaching myself here).

It is hard to teach oneself, when there are so many different versions out there.

See it Here...
 
Nice!
One remark though: the tables didn't collapse.
Probably because I use Netscape, and you put some specific javascript in.
I had the same problem once, if I remember correctly, there's something about style display that should be set to 'none' instead of 'hide'.
 
Actually, I was wondering that myself. I test using IE and Opera. Here is my javascript:

Code:
function showDiv(theSDiv, theHDiv)
{
	document.getElementById(theSDiv).style.display = 'block';
	document.getElementById(theHDiv).style.display = 'none';
}

If anyone can suggest the easiest (smallest) way to make this work for non-IE browsers, it would be great.

Since I like modular code, it would be nice if someone had a way to segregate the sniffer into multiple functions, i.e. isIE(), isNS5(), isDOM(), etc. Then this code could stay housed in this or another JS script, and the be referenced within the functions I already have, keeping the ocde very clean. Any suggestions?
 
Well, I decide, since this is going to be a private sight, with most using IE or Opera, that my current fix is fine. I found the reason why the collapse wasn't working in Opera was due to the <span> tag usage. Apparently Opera has no problems with span surrounding a table, but when embedded within a table, to encompas (sp?) a row, it isn't recognized. So, I added it as an attribute of the <TR> tab, and it is working great.

If you have Netscape, let me know if it works for you (the collapse that is):
AOL & Netscape Users Click Here

Thanks for everyone's help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top