Jump to content

Javascript that switches the Path?


kvnmck18

Recommended Posts

Can some please help me?(file type = .xsl)I need some kind of javascript (or something that will work with this) that can switch from "//pic[@category]" to either:"//pic[@category=kitchen]", "//pic[@category=bath]", "//pic[@category=home]". That is either done from a basic text link or a select form (I've tried both). This script will replace the following line (towards middle bottom of the .xsl):<xsl:for-each select="//pic[@category]">_________________________________________________________Something like this but works in XSL:<html><head><script type="text/javascript">function openKindofSel(){var kind_open=document.getElementById("kind")document.getElementById("show").value=kind_open.options.valuewriteindiv(kind_open.options.value,'test')}function writeindiv(text,id){if (document.getElementById){ x = document.getElementById(id); x.innerHTML = ''; x.innerHTML = text;}else if (document.all){ x = document.all[id]; x.innerHTML = text;}else if (document.layers){ x = document.layers[id]; text2 = '<P CLASS="testclass">' + text + '</P>'; x.document.open(); x.document.write(text2); x.document.close();}}</script></head><body><form><select id="kind" onchange="openKindofSel()"><option>select</option><option value="//pic[@category=kitchen]">Kitchen</option><option value="//pic[@category=bath]">Bath</option><option value="//pic[@category=home]">Home</option></select><input type="text" id="show"><div style="border:1px solid black;" id="test">Text will appear here</div></form></body></html>_________________________________________________________Here's my .xsl:_________________________________________________________<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><html><body><a name="top"></a><div>All Thumbnails:<br /><xsl:for-each select="//pic[@category]"><xsl:variable name="thumbs" select="thumbnail"/><xsl:variable name="links" select="link"/><xsl:variable name="titlename" select="description"/><a href="#{$links}"><img src="{$thumbs}" class="thumbss" title="{$titlename}"/></a></xsl:for-each></div><center><div id="greyba"><table border="0" cellspacing="0" class="maincontent"><xsl:for-each select="//pic[@category]"><tr><td><xsl:variable name="anchors" select="link"/><a name="{$anchors}"></a><xsl:variable name="srcl" select="leftpic"/><xsl:variable name="srcr" select="rightpic"/><img src="{$srcr}" /></td><td class="right" ><img src="{$srcl}" /><br /><xsl:value-of select="description"/></td></tr><tr><td class="botle">[<a href="#top">back to top</a>]</td><td></td></tr></xsl:for-each></table></div></center></body></html></xsl:template></xsl:stylesheet>_________________________________________________________I hope you can helpThank you,Kevin

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...