Banging my head against the wall…..
I have a SP list that uses an ajax script to pull different content into a page on click. I want the site owner to be able to enter a value in the list to determine which content is called up when the page opens.
The xsl:
<xsl:for-each select="//Data/Row">
<a>
<xsl:attribute name="href">javascript:ajaxpage('<xsl:value-ofselect="./@Target_x0020_page"/>','<xsl:value-of select="./@Target_x0020_div"/>');</xsl:attribute>
<xsl:value-of select="./@Category"/>
</a>
</xsl:for-each>
JS to open default content:
ajaxpage('2minxcat2.aspx' , 'index')
I’ve tried an xsl:if but it gets ignored.
Any help appreciated.
Clarification;
@CBono Sorry-the js is called with a link and works fine. This is an Office Live Small Business site-the xml is auto generated off the list and the xsl called in with a link. I’m trying to include this additional js snippet in the xsl so the owner can change which ajax content gets called in when the page opens by simply making a change in the list:
<script type="text/javascript"> ajaxpage('contenturlhere' , 'targetdiv') </script>
I’ve tried adding this:
<xsl:if test="Opening_x0020_category = 1"><script type="text/javascript">ajaxpage('<xsl:value-of select="./@Target_x0020_page"/>
‘,”)
But nothing gets outputted. It works as expected when the javascript above is inserted outside of the xsl.
The logic I want is “If one of the list items has a ‘1’ in a specified field, insert this content in this div when the page opens”.
XML:
Link
I just rebuilt it line by line and it worked. The problem was the js not the xsl. Somehow the js was getting broken up after I entered it. When I made sure it was on one line, it worked.
My own dumb fault. Thank you for your help.