Whenever i run this, it always outputs "BAD!!" Since it doesnt find the nodes. If i just use the XML and the XSLT outside of umbraco it works. So i think my XSLT is working properly....
When your XSLT "sees" the data it's just plain text - so it's not able to parse it like XML - maybe there's an Exslt extension function you can use to convert the text into XML for the stylesheet to transform?
Xml in textbox multiline, trying XSLT to html
Using latest version of umbraco, 4.0.2.1.
Windows Vista
IIS 7
Setup. Have a "textbox multiline" called pagerXml, with the following xml in it:
<?xml version="1.0" encoding="ISO-8859-1"?>
<pages>
<page>
<idAndClass>SlideHoliday</idAndClass>
<img_location>/gfx/slideheaders/holidaycoll.png</img_location>
<img_alt>Image alt</img_alt>
<text>
Blah blha blh blah blah blahblah blah blah
<br />
<br />
<a href="link.html">link</a>
</text>
</page>
</pages>
Have a XSLT file (I'm guessing that the issue is with the line i bolded):
<?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"/>
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:variable name="pagesData" select="$currentPage/data [@alias = 'pagerXml']/pages/page" />
<xsl:if test="count($pagesData) < 1">
BAD!!
</xsl:if>
<xsl:for-each select="$pagesData">
<div class="panel">
<xsl:attribute name="id">
<xsl:value-of select="idAndClass"/>
</xsl:attribute>
<div class="wrapper">
<div>
<xsl:attribute name="class">
<xsl:value-of select="idAndClass"/>
</xsl:attribute>
<div class="Slidetext">
<img width="235" height="83" class="slideheading">
<xsl:attribute name="src">
<xsl:value-of select="img_location"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="img_alt"/>
</xsl:attribute>
</img>
<p class="slidep">
<xsl:value-of select="text"/>
</p>
</div>
</div>
</div>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Whenever i run this, it always outputs "BAD!!" Since it doesnt find the nodes. If i just use the XML and the XSLT outside of umbraco it works. So i think my XSLT is working properly....
What am I doing wrong?!
Hi Scott,
When your XSLT "sees" the data it's just plain text - so it's not able to parse it like XML - maybe there's an Exslt extension function you can use to convert the text into XML for the stylesheet to transform?
/Chriztian
yes, you need to transform the text into XML. This was discussed on the old forum here
I am currently doing something similar and the solution by Adz at the bottom of the post works well.
That worked! Thanks!
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.