One problem is that you have multiple tags with the same ID name "accordion" ... each of these should be unique - otherwise which one is the accordion trying to access/use? (The first one it comes to, right?) I'd append a number to each of them "accordion1", "accordion2" and "accordion3"
Then switch the jQuery call to use the class name selection, rather than the ID name.
Thanks very much for your reply. I am a total novice in this area - could you explain me how to give the accordion unique tags? How you append a number to each of them?
Put some XLST inside a Accordion menu
Hallo,
on my webpage http://graver.eduaider.com/produktinformation/roegroer.aspx I would like an accordion menu displaying some XSLT stuff (Issuu pdf). I have this code inside my xslt page:
<xsl:if test="$currentPage/*[not(isDoc) and local-name() = $field]/value != ''">
<div id="accordion" class="accordionWrapper">
<div class="set">
<div class="title">Tryk her for at ekspandere</div>
<div class="content">
<xsl:value-of select="issuu:GetEmbedCode($currentPage/*[not(isDoc) and local-name() = $field]/value/@dataTypeId, $currentPage/*[not(isDoc) and local-name() = $field]/value, $width, $height)" disable-output-escaping="yes"/>
</div>
</div>
</div>
</xsl:if>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#accordion").msAccordion({defaultid:1, vertical:true});
}
)
</script>
The only problem is, that only the first item opens.
Any suggestions? Should i use for-each?
//Klaus
Hi Klaus,
One problem is that you have multiple tags with the same ID name "accordion" ... each of these should be unique - otherwise which one is the accordion trying to access/use? (The first one it comes to, right?) I'd append a number to each of them "accordion1", "accordion2" and "accordion3"
Then switch the jQuery call to use the class name selection, rather than the ID name.
Good luck!
Cheers, Lee.
Hello Lee,
Thanks very much for your reply. I am a total novice in this area - could you explain me how to give the accordion unique tags? How you append a number to each of them?
Thanks
Klaus
Hi Klaus,
Sure, no worries. In your XSLT are you writing out 3 separate accordion tags? If so, then change the ID name of each one:
Cheers, Lee.
Hallo again,
this is my XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:issuu="urn:issuu"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets issuu ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="field" select="/macro/field" />
<xsl:variable name="width" select="/macro/cssWidth" />
<xsl:variable name="height" select="/macro/cssHeight" />
<xsl:template match="/">
<div id="accordion" class="accordionWrapper">
<xsl:for-each select="$currentPage/*[not(isDoc) and local-name() = $field]/value">
<div id="" class="set">
<div class="title">Tryk her for at ekspandere</div>
<div class="content">
<xsl:value-of select="issuu:GetEmbedCode($currentPage/*[not(isDoc) and local-name() = $field]/value/@dataTypeId, $currentPage/*[not(isDoc) and local-name() = $field]/value, $width, $height)" disable-output-escaping="yes"/>
</div>
</div>
</xsl:for-each>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#accordion").msAccordion({defaultid:1, vertical:true});
}
)
</script>
</xsl:template>
</xsl:stylesheet>
Ah, are you re-using the same Macro 3 times? If so, is the "field" value different for each one?
Then try this:
Cheers, Lee.
Hi Lee,
I actually got it working by using an If statement instead.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:issuu="urn:issuu"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets issuu ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="field" select="/macro/field" />
<xsl:variable name="width" select="/macro/cssWidth" />
<xsl:variable name="height" select="/macro/cssHeight" />
<xsl:template match="/">
<div id="accordion" class="accordionWrapper">
<div id="" class="set">
<div class="title">Tryk her for at ekspandere</div>
<div class="content">
<xsl:if test="$currentPage/*[not(isDoc) and local-name() = $field]/value != ''">
<xsl:value-of select="issuu:GetEmbedCode($currentPage/*[not(isDoc) and local-name() = $field]/value/@dataTypeId, $currentPage/*[not(isDoc) and local-name() = $field]/value, $width, $height)" disable-output-escaping="yes"/>
</xsl:if>
</div>
</div>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#accordion").msAccordion({defaultid:1, vertical:true});
}
)
</script>
</xsl:template>
</xsl:stylesheet>
Can you tell me why?
/Klaus
is working on a reply...