Copied to clipboard

Flag this post as spam?

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


  • Vincent DeCapite 64 posts 83 karma points
    Mar 09, 2011 @ 15:52
    Vincent DeCapite
    0

    XSLT automatic Formatting

    Hi There,

    I have a chunck of XSLT that I am using to display a field. I want it to be formatted in a certain font size no matter what the user input as a font size through the style menu. Can this be done through the XSLT?

    My code looks like this:

    <xsl:if test="$product/data [@alias = 'textdisclaimers'] != ''">
            <div class="smaller" style="font-size:smaller">    <xsl:value-of select="$product/data [@alias = 'textdisclaimers']" disable-output-escaping="yes" /></div>
    </xsl:if>
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 09, 2011 @ 20:07
    Jan Skovgaard
    1

    Hi Vincent

    I think the above is a bit of a bad approach since the naming is non-semantic and you're using inline styles.

    I think I would create at div with a more meaninfull name like "disclaimer" and then set the font-size in an external stylesheet. If neccesary use !important to ensure that the choosable styles from the RTE will not override the font-size.

    Hope these pointers helps :-)

    /Jan

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Mar 10, 2011 @ 00:08
    Chriztian Steinmeier
    0

    Hi Vincent,

    I'm with Jan on this, but I've also seen what clients are capable of :-)

    Too ensure that you can override the styles, use an id on the wrapping div, and use !important to overrule, e.g.:

    /* CSS */
    #disclaimer { font-size: WHATEVER; }
    #disclaimer * { font-size: 1em !important; color: inherit !important; }
    <!-- XSLT -->
    <xsl:if test="$product/data[@alias = 'textdisclaimers']">
        <div id="disclaimer">
            <xsl:value-of select="$product/data[@alias = 'textdisclaimers']" disable-output-escaping="yes" />
        </div>
    </xsl:if>
    

     

    /Chriztian 

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies