1

I am using an XML Viewer Web Part to display an RSS Feed from a blog on a company website. The problem is that in the viewer, different articles have a different font size and style, whereas I would like them to all be in the same size and font. Here is the XSL code I'm using:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:template match="rss">
  <div style="background:#fff; padding:0; font-size:12px;">
       <xsl:for-each select="channel/item">
        <h1><a href="{link}" target="_new"><xsl:value-of select="title"/></a></h1><br/>    
        <xsl:value-of disable-output-escaping="yes" select="description"/><br/>
      </xsl:for-each>
  </div>
</xsl:template>
 <xsl:template match="description"><xsl:value-of select="."/><br/></xsl:template>
</xsl:stylesheet>

Any idea how to fix this? Thanks.

1 Answer 1

1

You'd want to wrap your description like this:

<div style="font-size:12px; font-family:arial;">
  <xsl:value-of disable-output-escaping="yes" select="description"/>
</div>

This may or may not work properly if the descriptions from the feed have inline styling as those would take priority over styles from the div wrapper.

1
  • Thank you, but it didn't work. Is there any way to get around the inline styling? Aug 13, 2014 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.