I can't figure out why I'm getting a bunch of extra <div>s and <a>s from this stylesheet. Does anyone see anything wrong with it that would cause unexpected output?
<xsl:template match="/"> <xsl:variable name="items" select="$currentPage/mainGraphic/DAMP[@fullMedia]/mediaItem/Image"/> <!--In "new" multiple media items can be stored with the full media xml.--> <xsl:choose> <xsl:when test="count($items) > 1"> <div class="wt-rotator"> <div class="screen"> <noscript> <img src="/media/113/images/img1.jpg" alt="Jerry Rose Floral + Event Planning" /> </noscript> </div> <div class="c-panel"> <div class="buttons"> <div class="prev-btn"></div> <div class="play-btn"></div> <div class="next-btn"></div> </div> <div class="thumbnails"> <ul> <xsl:for-each select="$currentPage/mainGraphic/DAMP[@fullMedia]/mediaItem/Image"> <li> <a href="{umbracoFile}" title="Jerry Rose Floral and Event Planning"><img src="{umbracoFile}" /></a> </li> </xsl:for-each> </ul> </div> </div> </div> </xsl:when> <xsl:otherwise> <xsl:for-each select="$currentPage/mainGraphic/DAMP[@fullMedia]/mediaItem/Image"> <img src="{umbracoFile}" /> </xsl:for-each> </xsl:otherwise> </xsl:choose> </xsl:template>
Basically, I'm getting the following extra code that shouldn't be there (but only from the "when' clause, not the "otherwise"):
<a href="#"></a> </div> <a href="#"></a> </div> <a href="#"> <div id="footer"> JERRY ROSE FLORAL + EVENT DESIGN 176 MAPLEWOOD AVENUE, MAPLEWOOD NJ 07040 TEL +973-762-1085 +212-766-5600</div> </a> </div>
It's wrapping the footer <div> in an <a>, which it shouldn't be, as well as adding the code above it, which also shouldn't be there. The jquery plugin was working fine until I put the HTML sorrounding the <xsl> elements into the XSLT document (rather than in the template). I moved it into the XSLT document so that when there is only one image, to display it as a static image (rather than through the jquery slideshow).
This will cause the code to collapse, if you have the output method set to xml. If you set it to html, this can cause some other problems with some closing tags, so what I'd do is to insert something in the empty tags. You can do this some different ways. Like eg.:
xslt output mystery, extra divs
I can't figure out why I'm getting a bunch of extra <div>s and <a>s from this stylesheet. Does anyone see anything wrong with it that would cause unexpected output?
Basically, I'm getting the following extra code that shouldn't be there (but only from the "when' clause, not the "otherwise"):
It's wrapping the footer <div> in an <a>, which it shouldn't be, as well as adding the code above it, which also shouldn't be there. The jquery plugin was working fine until I put the HTML sorrounding the <xsl> elements into the XSLT document (rather than in the template). I moved it into the XSLT document so that when there is only one image, to display it as a static image (rather than through the jquery slideshow).
I disabled the jquery to troubleshoot, and it looks like the problem is stemming from the XSLT output.. For some reason it's closing the
Fixed it, I think. I just needed to change output mode to html.
Hi Laura
The code will be messed up because you have some elements with no content in them. Like these:
This will cause the code to collapse, if you have the output method set to xml. If you set it to html, this can cause some other problems with some closing tags, so what I'd do is to insert something in the empty tags. You can do this some different ways. Like eg.:
/Kim A
is working on a reply...