<xsl:variable name="RSSDescription" select="string('iwonder management team, have over 40 years of experience working with insurance technology and have developed a range of products to help brokers and aggregators thrive')"/>
<!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
It´s should be posible to style a RSS feed in XML document with CSS. Have you tried to click on the link to stylesheet. Just to check that the browser can find and load the stylesheet.
It´s should be posible to style a RSS feed in XML with inline CSS.
You should be able to use the STYLE attribute to add styles to individual elements inline, i.e., within the XML document. The generic inline style syntax is :
The reason for the stylesheet not taking effect is that the xml-stylesheet processing instruction is part of the XSLT stylesheet, not the output document. So in effect, you're actually assigning the CSS stylesheet to the XSLT stylesheet (which is perfectly possible :-)
You need to generate the processing instruction as part of the output using the <xsl:processing-instruction /> element, like this:
I added the code you told me, and tried all possible ways, but it does not show the style :( I cann't see the title of the news in ie or firefox too... I cannot understand why.
<xsl:variable name="RSSDescription" select="string('iwonder management team, have over 40 years of experience working with insurance technology and have developed a range of products to help brokers and aggregators thrive')"/>
<!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
Hi Chriztian and Dennis,
I added the code you told me, and tried all possible ways, but it does not show the style :(
(it generates the code in output though: )
I can't see the title of the news in ie or firefox too... I cannot understand why.
Hi Chriztian and Dennis,
I added the code you told me, and tried all possible ways, but it does not show the style :(
I cann't see the title of the news in ie or firefox too... I cannot understand why.
<!-- change the mimetype for the current page to xml -->
<xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
<xsl:text disable-output-escaping="yes"><?xml version="1.0" encoding="UTF-8"?></xsl:text>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<xsl:processing-instruction name="xml-stylesheet">type="text/css" href="/css/rss.css"</xsl:processing-instruction>
Chriztian, I have made my wqebsite in visial studio 2010 and the database in SQLYog - now i have to convert it to VS 2008 and database SQL server.
I have spent lots of time but i cannot open the .sql in SQL server... when i open it as a script file, then i get lots of syntax error.... So i am going to start the website from the begining :(
I just thought to put this question here to see if you or anyone else knows if there is any quicker way. (also do you know if i vb 2008 will be ok with umbraco or not? i had some difficulty before)
I just noticed that my RSS page shows some code after the news items at the bottom of the page JUST in google chrome. this is my code. anybody knows why? :(
<!-- Update these variables to modify the feed --> <xsl:variable name="RSSNoItems" select="string('10')"/> <xsl:variable name="RSSTitle" select="string('iwonder RSS News Feed')"/> <xsl:variable name="SiteURL" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))"/> <xsl:variable name="RSSDescription" select="string(' iwonder management team, have over 40 years of experience working with insurance technology and have developed a range of products to help brokers and aggregators thrive')"/>
<!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
RSS Style with CSS
Hello - I have create a rss page with umbraco, but the problem is i cannot style it with the css i made in stylesheet folder.
I have added this line to my xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="../css/rss.css"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0" .......
and added some css code to rss.css like:
item {
display: block;
margin-bottom: 30pt;
margin-left; 0;
}
Title{
padding: 0 0 20px 0;
color: #57AB81;
font-size: 30px;
font-weight:bold;
display: block;
width:100%;
text-align:center;
clear:both;
}
anybody knows why the css file doesn't do anything?
Thanks in advance,
Mitra
Hi Mitra and welcome to our :-),
Did you put your stylesheets into the CSS folder in Umbraco. Or did you use another folder, that you have created yourself.
I you use the bulid in CSS folder with Umbraco you could try this.
Hope this helps you
/Dennis
Thanks Dennis for your reply.
I have made it under stylesheets and the css is in my css folder next to the other css for the website.
item {
Title{
Hi Mitra,
Okay have you tried to change from this:
To this: Does this have any effect, on the XML document.
/Dennis
I have tried every combination. It looks like it is not reading the css file at all. Is there any way that i add the stylesheet in the xml file?
Many thanks,
Mitra
This is the xml file: (I cannot even see the news titles in internet explorer or firefox)
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/css/rss.css" type="text/css" ?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rssdatehelper="urn:rssdatehelper"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- Update these variables to modify the feed -->
<xsl:variable name="RSSNoItems" select="string('10')"/>
<xsl:variable name="RSSTitle" select="string('iwonder RSS News Feed')"/>
<xsl:variable name="SiteURL" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))"/>
<xsl:variable name="RSSDescription" select="string('iwonder management team, have over 40 years of experience working with insurance technology and have developed a range of products to help brokers and aggregators thrive')"/>
<!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
<xsl:variable name="publicationDate">
<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:sort select="@publicationDate" data-type="text" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="publicationDate" />
</xsl:if>
</xsl:for-each>
<!--<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:if test="newsVisible = 1">
<xsl:apply-templates/>
</xsl:if>
</xsl:for-each>-->
</xsl:variable>
<xsl:template match="/">
<!-- change the mimetype for the current page to xml -->
<xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
<xsl:text disable-output-escaping="yes"><?xml version="1.0" encoding="UTF-8"?></xsl:text>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<channel>
<Title>
<xsl:value-of select="$RSSTitle"/>
</Title>
<link>
<xsl:value-of select="$SiteURL"/>
</link>
<pubDate>
<xsl:value-of select="$publicationDate"/>
</pubDate>
<generator>umbraco</generator>
<description>
<xsl:value-of select="$RSSDescription"/>
</description>
<language>en</language>
<xsl:apply-templates select="$currentPage/news/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort select="@publicationDate" order="descending" />
</xsl:apply-templates>
</channel>
</rss>
</xsl:template>
<xsl:template match="* [@isDoc]">
<xsl:if test="position() <= $RSSNoItems">
<xsl:variable name="Visible" select="newsVisible" />
<xsl:if test="$Visible = '1'" >
<item>
<Title>
<xsl:value-of select="newsHeadline"/>
</Title>
<link>
<xsl:value-of select="$SiteURL"/>
<xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
</link>
<pubDate>
<xsl:value-of select="publicationDate"/>
</pubDate>
<!--<guid>
<xsl:value-of select="$SiteURL"/>
<xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
</guid> -->
<content:encoded>
<xsl:value-of select="newsSummary" disable-output-escaping="yes"/>
</content:encoded>
</item>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Mitra,
It´s should be posible to style a RSS feed in XML document with CSS. Have you tried to click on the link to stylesheet. Just to check that the browser can find and load the stylesheet.
/Dennis
Hi Mitra,
It´s should be posible to style a RSS feed in XML with inline CSS.
You should be able to use the STYLE attribute to add styles to individual elements inline, i.e., within the XML document. The generic inline style syntax is :
<elementname STYLE = "propertyname : value">............</elementname>
http://usefultechtalk.blogspot.dk/2012/09/all-about-styling-xml-with-internal-and.html
I hope this can help you solve your issue, with styling the XML.
/Dennis
Hi Mitra (+ Dennis)
The reason for the stylesheet not taking effect is that the xml-stylesheet processing instruction is part of the XSLT stylesheet, not the output document. So in effect, you're actually assigning the CSS stylesheet to the XSLT stylesheet (which is perfectly possible :-)
You need to generate the processing instruction as part of the output using the
<xsl:processing-instruction />
element, like this:/Chriztian
Hi Chriztian and Dennis,
I added the code you told me, and tried all possible ways, but it does not show the style :(
I cann't see the title of the news in ie or firefox too... I cannot understand why.
I post the code here:
<?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:rssdatehelper="urn:rssdatehelper"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- Update these variables to modify the feed -->
<xsl:variable name="RSSNoItems" select="string('10')"/>
<xsl:variable name="RSSTitle" select="string('iwonder RSS News Feed')"/>
<xsl:variable name="SiteURL" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))"/>
<xsl:variable name="RSSDescription" select="string('iwonder management team, have over 40 years of experience working with insurance technology and have developed a range of products to help brokers and aggregators thrive')"/>
<!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
<xsl:variable name="publicationDate">
<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:sort select="@publicationDate" data-type="text" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="publicationDate" />
</xsl:if>
</xsl:for-each>
<!--<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:if test="newsVisible = 1">
<xsl:apply-templates/>
</xsl:if>
</xsl:for-each>-->
</xsl:variable>
<xsl:template match="/">
<!-- change the mimetype for the current page to xml -->
<xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
<xsl:text disable-output-escaping="yes"><?xml version="1.0" encoding="UTF-8"?></xsl:text>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<xsl:processing-instruction name="xml-stylesheet">type="text/css" href="/css/rss.css"</xsl:processing-instruction>
<channel>
<Title>
<xsl:value-of select="$RSSTitle"/>
</Title>
<link>
<xsl:value-of select="$SiteURL"/>
</link>
<pubDate>
<xsl:value-of select="$publicationDate"/>
</pubDate>
<generator>umbraco</generator>
<description>
<xsl:value-of select="$RSSDescription"/>
</description>
<language>en</language>
<xsl:apply-templates select="$currentPage/news/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort select="@publicationDate" order="descending" />
</xsl:apply-templates>
</channel>
</rss>
</xsl:template>
<xsl:template match="* [@isDoc]">
<xsl:if test="position() <= $RSSNoItems">
<xsl:variable name="Visible" select="newsVisible" />
<xsl:if test="$Visible = '1'" >
<item>
<Title>
<xsl:value-of select="newsHeadline"/>
</Title>
<link>
<xsl:value-of select="$SiteURL"/>
<xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
</link>
<pubDate>
<xsl:value-of select="publicationDate"/>
</pubDate>
<!--<guid>
<xsl:value-of select="$SiteURL"/>
<xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
</guid> -->
<content:encoded>
<xsl:value-of select="newsSummary" disable-output-escaping="yes"/>
</content:encoded>
</item>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Chriztian and Dennis, I added the code you told me, and tried all possible ways, but it does not show the style :( (it generates the code in output though: ) I can't see the title of the news in ie or firefox too... I cannot understand why.
I post the code here:
' ]>
-->
'
Hi Chriztian and Dennis, I added the code you told me, and tried all possible ways, but it does not show the style :( I cann't see the title of the news in ie or firefox too... I cannot understand why.
I post the code here: ]>
-->
Hi again, Mitra
It looks like your comments are now getting caught in the Spam filter, I'll see if I can have someone look at that.
Meanwhile, to fix your problem - try moving the processing instruction up so it appears before the
<rss
root element./Chriztian
Thanks a lot Chriztian, for some reason i cannot post anything here.
I'll try what you wrote and will let you know.
Chriztian, I have made my wqebsite in visial studio 2010 and the database in SQLYog - now i have to convert it to VS 2008 and database SQL server.
I have spent lots of time but i cannot open the .sql in SQL server... when i open it as a script file, then i get lots of syntax error.... So i am going to start the website from the begining :(
I just thought to put this question here to see if you or anyone else knows if there is any quicker way. (also do you know if i vb 2008 will be ok with umbraco or not? i had some difficulty before)
many thanks,
Mitra
Hello again,
I just noticed that my RSS page shows some code after the news items at the bottom of the page JUST in google chrome. this is my code. anybody knows why? :(
<?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:rssdatehelper="urn:rssdatehelper"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- Update these variables to modify the feed -->
<xsl:variable name="RSSNoItems" select="string('10')"/>
<xsl:variable name="RSSTitle" select="string('iwonder RSS News Feed')"/>
<xsl:variable name="SiteURL" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))"/>
<xsl:variable name="RSSDescription" select="string(' iwonder management team, have over 40 years of experience working with insurance technology and have developed a range of products to help brokers and aggregators thrive')"/>
<!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
<xsl:variable name="publicationDate">
<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:sort select="@publicationDate" data-type="text" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="publicationDate" />
</xsl:if>
</xsl:for-each>
<!--<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:if test="newsVisible = 1">
<xsl:apply-templates/>
</xsl:if>
</xsl:for-each>-->
</xsl:variable>
<xsl:template match="/">
<!-- change the mimetype for the current page to xml -->
<xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
<xsl:text disable-output-escaping="yes"><?xml version="1.0" encoding="UTF-8"?></xsl:text>
<xsl:processing-instruction name="xml-stylesheet">type="text/css" href="/css/rss.css"</xsl:processing-instruction>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<channel>
<image>
<!--<url>http://localhost/sitepix/structural/iwonder-logo.png</url>;
<title>iwonder logo</title>
<link>./</link>
<width>150</width>
<height>130</height>
<description>iwonder</description>-->
</image>
<Title>
<xsl:value-of select="$RSSTitle"/>
</Title>
<link>
<xsl:value-of select="$SiteURL"/>
</link>
<pubDate>
<xsl:value-of select="$publicationDate"/>
</pubDate>
<generator>umbraco</generator>
<description>
<xsl:value-of select="$RSSDescription"/>
</description>
<language>en</language>
<xsl:apply-templates select="$currentPage/news/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort select="@publicationDate" order="descending" />
</xsl:apply-templates>
</channel>
</rss>
</xsl:template>
<xsl:template match="* [@isDoc]">
<xsl:if test="position() <= $RSSNoItems">
<xsl:variable name="Visible" select="newsVisible" />
<xsl:if test="$Visible = '1'" >
<item>
<Title>
<xsl:value-of select="newsHeadline"/>
</Title>
<link>
<xsl:value-of select="$SiteURL"/>
<xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
</link>
<pubDate>
<xsl:value-of select="publicationDate"/>
</pubDate>
<!--<guid>
<xsl:value-of select="$SiteURL"/>
<xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
</guid> -->
<content:encoded>
<xsl:value-of select="newsSummary" disable-output-escaping="yes"/>
</content:encoded>
</item>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
is working on a reply...