Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've used XSL in .Net for a while now. I'm trying to view a media folder, which works and I can get the item and view the URL, however, when I try and display it as an html element it says
<?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:CWS.Twitter="urn:CWS.Twitter" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets CWS.Twitter ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/><xsl:variable name="mediaFolderId" select="number($currentPage/mediaFolderId)" /> <xsl:variable name="thumbWidth" select="number(256)" /> <xsl:variable name="thumbHeight" select="number(170)" /><xsl:template match="/">
<xsl:if test="number($mediaFolderId)"> <ul id="gallery"> <xsl:for-each select="umbraco.library:GetMedia($mediaFolderId, true())/Image"> <xsl:variable name="picFile" select="umbracoFile"/> <xsl:if test="umbracoFile !=''"> <li> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="./umbracoFile" /> </xsl:attribute> </xsl:element> </li> </xsl:if> </xsl:for-each> </ul> </xsl:if></xsl:template>
</xsl:stylesheet>
Why can't I do:
<xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="./umbracoFile" /> </xsl:attribute> </xsl:element>
to show an element? If I just do the <xsl:value-of select="./umbracoFile"/> I get
SoI know the element is there, I just can't build it (Umbraco in the back end doesn't show any validation errors either)
Any pointers would be great.
Seems like your code should work. Tried saving it wihtout checking for errors?You can always try:
<a> <xsl:attribute name="href"> <xsl:value-of select="./UmbracoFile" /> </xsl:attribute> LinkText </a>
Weird, I've done a substring to get rid of the ~ symbol, and its working now. How odd.
For the record, if you're simply outputting data, this syntax is simpler:
<a href="{umbracoFile}">LinkText</a>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Adding attributes using XSL
I've used XSL in .Net for a while now. I'm trying to view a media folder, which works and I can get the item and view the URL, however, when I try and display it as an html element it says
Why can't I do:
to show an element? If I just do the <xsl:value-of select="./umbracoFile"/> I get
SoI know the element is there, I just can't build it (Umbraco in the back end doesn't show any validation errors either)
Any pointers would be great.
Seems like your code should work. Tried saving it wihtout checking for errors?
You can always try:
Weird, I've done a substring to get rid of the ~ symbol, and its working now. How odd.
For the record, if you're simply outputting data, this syntax is simpler:
is working on a reply...