Jump to content

HELP! Requires: JAVASCRIPT & XSL


kvnmck18

Recommended Posts

If you know javascripts and XSL well please send me a private message. I'm trying to make javascript that switches the path of a select in a xsl:for-each; to go from default (//pic[@category]) to new/different path (like: //pic[@category=bath] or //pic[@category=kitchen])I will further more explain what I'm trying to do and send you a zip (if you want) of the files I'm working on.I hope there is someone that can help!

Link to comment
Share on other sites

.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><style type="text/css">#greyba {width:100%;background-color:#999;margin-top:20px;border-top:1px solid #000;border-bottom:1px solid #000;padding-bottom:20px;background-image:url(stripes.gif);background-attachment:fixed}body {font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;margin:0}table {margin:0;padding:0;border:0;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px}table.maincontent {margin:0;padding:0;border:4px inset #999;border-left:4px outset #999;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;margin-top:20px;background-color:#FFF}td {margin:0;padding:0;border:0;}td.botle {vertical-align:top;text-align:left;height:50px}td.two {margin:0;padding:2px;padding-left:10px;border:0;border-bottom:1px solid #000;background-color:#CCC}td.right {margin:0;padding:0;border:0;padding-left:5px;vertical-align:top;text-align:center;font-variant:small-caps;font-size:22px;letter-spacing:-3px;}tr {margin:0;padding:0;border:0}img {border:1px solid #000}img.thumbss {border:1px solid #000;margin:4px}a {color:#000;border-top:1px solid #000;border-bottom:1px solid #000;text-decoration:none}a:hover {color:#FFF;background-color:#000;border-top:1px solid #000;border-bottom:1px solid #000;text-decoration:none}</style><body><a name="top"></a><div>[b]<form><select><option>select</option><option>Kitchen</option><option>Bath</option><option>Home</option></select></form>[/b]All Thumbnails:<br /><xsl:for-each select="[b]//pic[@category][/b]"><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="[b]//pic[@category][/b]"><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> 

The bold is what needs to be changed.Here are some tried javascripts:

 <script>function Writeln(){var txtvar kind_open=document.getElementById("kind")txt = kind_open.options.value;document.write('<xsl:for-each select='+ txt +'>')}</script><select onchange="Writeln()"><option value="//pic[@category]">All</option><option value="//pic[@category='kitchen']">Kitchen</option><option value="//pic[@category='bath']">Bath</option><option value="//pic[@category='home']">Home</option></select></form>All Thumbnails:<br /><script>WriteLn();</script><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>

This does not work for a couple reasons but one I need a "default" document.write for the "WriteLn()".HERE IS A ZIP OF THE XSL AND XML SO YOU CAN UNDERSTAND WHAT I'M DOING BETTER: HELP ME ZIP

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...