Using Ultimate picker for related content with Umbraco 4.5
Hi!
I've been using Lee Kelleher's example for some time with the old schema but can't get it to work using 4.5. I've tried updating the script using the XSLT updater but I'm can't seem to get any values to show. I can get the related pages to show in the ultimate picker but I can't get the data to show. Any ideas?
I think you need to alter this line <xsl:for-each select="$nodeIds/value"> to use double // like this <xsl:for-each select="$nodeIds//value">, or maybe just write <xsl:for-each select="$nodeIds/values/value">
System.Xml.XmlException: The 'xsl:stylesheet' start tag on line 3 position 2 does not match the end tag of 'xsl:output'. Line 37, position 15. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag) at System.Xml.XmlTextReaderImpl.ParseEndElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() at System.Xml.Xsl.Xslt.XsltInput.MoveToNextSibling() at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) at System.Xml.Xsl.Xslt.XsltLoader.LoadContent(Boolean hasSelect) at System.Xml.Xsl.Xslt.XsltLoader.XslVarPar() at System.Xml.Xsl.Xslt.XsltLoader.LoadGlobalVariableOrParameter(NsDecl stylesheetNsList, XslNodeType nodeType) at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
The above error show. then i modify after that no result come. Please help me. to seperate the value from ultimate picker check box list. Thank you.
Using Ultimate picker for related content with Umbraco 4.5
Hi!
I've been using Lee Kelleher's example for some time with the old schema but can't get it to work using 4.5. I've tried updating the script using the XSLT updater but I'm can't seem to get any values to show. I can get the related pages to show in the ultimate picker but I can't get the data to show. Any ideas?
<?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" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="preNodes">
<xsl:variable name="relatedContent" select="$currentPage/puffPicker" />
<xsl:variable name="nodeIds" select="umbraco.library:Split($relatedContent, ',')" />
<xsl:for-each select="$nodeIds/value">
<xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="nodes" select="msxml:node-set($preNodes)/node" />
<xsl:if test="count($nodes) > 0">
<xsl:for-each select="$nodes">
<xsl:value-of select="test"/>
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Niklas
I think you need to alter this line <xsl:for-each select="$nodeIds/value"> to use double // like this <xsl:for-each select="$nodeIds//value">, or maybe just write <xsl:for-each select="$nodeIds/values/value">
Hope this helps.
/Jan
Hi Jan
Thanks for your reply. Tried it both ways but nothing happened I'm afraid. Is there anything else you can think of?
/ Niklas
Hi Niklas
Hmm, what does the returned XML from $relatedContent look like?
try writing this and see what XML gets returned
/Jan
Hi Jan
It now looks lite this
<xsl:variable name="preNodes">
<xsl:variable name="relatedContent" select="$currentPage/puffPicker" />
<xsl:variable name="nodeIds" select="umbraco.library:Split($relatedContent, ',')" />
<xsl:for-each select="$nodeIds//value">
<textarea>
<xsl:copy-of select="$relatedContent" />
</textarea>
<xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
</xsl:for-each>
</xsl:variable>
But it still returns nothing :(
Niklas,
I think Jan was asking to see the output generated from the xslt above, what actually gets rendered to the page when you load the webpage?
If the above doesn't return anything then your property alias is incorrect or your content picker hasn't saved.
Rich
Hi Rich
I'm not getting any data from the xslt. The output is blank. Is there any way to check if my content picker has saved?
/ Niklas
Asked Lee for help and he gave me this nifty solution.
<xsl:variable name="relatedContent" select="$currentPage/RelatedContent" />
<xsl:variable name="nodes" select="msxml:node-set($preNodes)/*[@isDoc]" />
If you change this everything works just fine :)
Glad I could help. Just for reference, a link to my blog comments.
Cheers, Lee.
Hi every one i have ultimate picker name (selected bebefits and the alise name selectTheBenefits it hold the data) but in reply i did not get nothing. The code are below. I user the this link code (http://leekelleher.com/2009/09/08/umbraco-ultimate-picker-xslt-example/#comment-619)
System.Xml.XmlException: The 'xsl:stylesheet' start tag on line 3 position 2 does not match the end tag of 'xsl:output'. Line 37, position 15.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
at System.Xml.Xsl.Xslt.XsltInput.MoveToNextSibling()
at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
at System.Xml.Xsl.Xslt.XsltLoader.LoadContent(Boolean hasSelect)
at System.Xml.Xsl.Xslt.XsltLoader.XslVarPar()
at System.Xml.Xsl.Xslt.XsltLoader.LoadGlobalVariableOrParameter(NsDecl stylesheetNsList, XslNodeType nodeType)
at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet()
at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
The above error show. then i modify after that no result come. Please help me. to seperate the value from ultimate picker check box list. Thank you.
<?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" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="preNodes">
<xsl:variable name="relatedContent" select="$currentPage/*[@id=1098]/*[@alias='selectTheBenefits']" />
<xsl:variable name="nodeIds" select="umbraco.library:Split($relatedContent, ',')" />
<xsl:for-each select="$nodeIds/value">
<textarea>
<xsl:copy-of select="$relatedContent" />
</textarea>
<xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="nodes" select="msxml:node-set($preNodes)/node" />
<xsl:if test="count($nodes) > 0">
<div class="related-content">
<h3>Related Content</h3>
<ul>
<xsl:for-each select="$nodes">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName">
</xsl:value-of></a></li>
</xsl:for-each></ul>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
is working on a reply...