Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin Farrow 46 posts 67 karma points
    Jun 03, 2010 @ 17:01
    Kevin Farrow
    0

    XSLT not creating correct </div>

    i have some XSLT code to create a list of DIV's for a carousel. Unfortunately the html generated from the code below closes the div in the wrong place for what I need:

    <xsl:element name="div">
      <xsl:attribute name="style">
        <xsl:value-of select="umbraco.library:GetMedia(./@id,'false')/data [@alias = 'umbracoFile']"/>
      </xsl:attribute>
    </xsl:element>

    produces.......

    <div style="/media/1850/billboard_placeholder.jpg" />
    <div style="/media/1896/billboard_placeholder.jpg" />

    I really need it to create the closing </div> like so:

    <div style="/media/1850/billboard_placeholder.jpg"></div>
    <div style="/media/1896/billboard_placeholder.jpg"></div>

    as the carousel don't work no more. Any help would be appreciated.

    Regards,
    Kevin

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 03, 2010 @ 17:03
    Matt Brailsford
    0

    Hey Kevin,

    Try forcing a space within the div

    <xsl:element name="div">
      <xsl:attribute name="style">
        <xsl:value-of select="umbraco.library:GetMedia(./@id,'false')/data [@alias = 'umbracoFile']"/>
      </xsl:attribute>
      <xsl:text> </xsl:text>
    </xsl:element>

    Matt

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jun 03, 2010 @ 17:05
    Lee Kelleher
    0

    Hi Kevin,

    You either need to change the output mode of the XSLT to "html":

    <xsl:output method="html" />

    or, include some kind of spacer inside the <div>, like so:

    <xsl:element name="div">
        <xsl:attribute name="style">
            <xsl:value-of select="umbraco.library:GetMedia(./@id,'false')/data [@alias = 'umbracoFile']"/>
        </xsl:attribute>
        <xsl:comment><xsl:text>.</xsl:text></xsl:comment>
    </xsl:element>

    Cheers, Lee.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jun 03, 2010 @ 17:08
    Lee Kelleher
    0

    Damn, replied the same time as Matt. LOL!

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 03, 2010 @ 17:11
    Matt Brailsford
    0

    ;)

  • Kevin Farrow 46 posts 67 karma points
    Jun 03, 2010 @ 17:40
    Kevin Farrow
    0

    ok, sorted it by having a cup of tea and rewriting it :-) Thanks for all the help though.

Please Sign in or register to post replies

Write your reply to:

Draft