<!-- Don't change this, but add a 'contentPicker' element to --> <!-- your macro with an alias named 'source' --> <xsl:variable name="source" select="/macro/source"/> <xsl:variable name="maxItems" select="/macro/maxItems"></xsl:variable>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:sort select="@createDate" order="descending"/> <xsl:if test="position() <= $maxItems"> <h3> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </h3> <br></br> <p> <xsl:value-of select="substring(umbraco.library:StripHtml(data [@alias = 'bodyText']),1,255)" disable-output-escaping="yes"/> </p> </xsl:if> </xsl:for-each> </ul>
</xsl:template>
</xsl:stylesheet>
the problem is, its only display the titles of the news but not the bodytext, any clue about my xslt is highliy appreciated..
I don't think you need the disable-output-escaping attribute since you are stripping out all html. If the above works you can merge the two lines into one as you like.
News teaser,It displayed the title but not the bodytext
Dear All,
today i creates the news teaser with the xslt like this
<?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: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"/>
<!-- Don't change this, but add a 'contentPicker' element to -->
<!-- your macro with an alias named 'source' -->
<xsl:variable name="source" select="/macro/source"/>
<xsl:variable name="maxItems" select="/macro/maxItems"></xsl:variable>
<xsl:template match="/">
<!-- The fun starts here -->
<ul>
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort select="@createDate" order="descending"/>
<xsl:if test="position() <= $maxItems">
<h3>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</h3>
<br></br>
<p>
<xsl:value-of select="substring(umbraco.library:StripHtml(data [@alias = 'bodyText']),1,255)" disable-output-escaping="yes"/>
</p>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
the problem is, its only display the titles of the news but not the bodytext, any clue about my xslt is highliy appreciated..
thanks
Hi ridi,
In the new schema you don't need to use the data[@alias=';] bit anymore. Try this:
I don't think you need the disable-output-escaping attribute since you are stripping out all html. If the above works you can merge the two lines into one as you like.
Hope that works,
Sascha
it's working like a charm, thanks Sascha :)
Great, glad to hear that! :)
is working on a reply...
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.